I'm looking a using Siverstripe's blog module for a project. The blog has most of the features I want, but as the site is mostly book focused I's like to add some fields to the blogpost table to hold book data (title, author, rating, etc. It seems like this should be relatively simple but I can't seem to get it to work. I've created the following extension PHP file:
namespace SilverStripe\Blog\Model;
use SilverStripe\Blog\Model\BlogPost;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\Forms\TextareaField;
class BookDataExtension extends BlogPost
{
private static $db = [
'bookTitle' => 'Varchar',
'bookAuthor' => 'Varchar',
'bookSeries' => 'Varchar',
'bookISBN' => 'Varchar',
'bookSeriesNum' => 'Int',
'bookRating' => 'Decimal',
'bookCover' => 'Varchar'
];
}
And added the following to the mysite.yml file:
SilverStripe\Blog\BlogPost:
extensions:
- SilverStripe\Blog\BookDataExtension
I also tried adding the above to the config.yml file for the blog module itself. However, no matter what I try, when I rebuild the system it creates new table(s) for BookDataExtension rather than adding the fields to the BlogPost table. What am I doing wrong?