Silverstripe Version: 5.13
Question:
I have the SilverStripe Blog Module installed. Have extended BlogPost to add extra functionality, and this is working just fine. Eg. I have added a Subtitle field.
class BlogPostExtension extends DataExtension {
private static $db = [
'Subtitle' => 'Varchar'
];
// can access $this->owner->dbObject('Subtitle') on all pages with class BlogPost
...
}
blog.yml:
SilverStripe\Blog\Model\BlogPost:
extensions:
- App\Web\BlogPostExtension
Now, I have a subclass of BlogPost, let’s say BlogPostSubClass. When I try to access fields added via the extension, I cannot access data on them, yet the fields render in template.
class BlogPostSubClass extends BlogPost {
...
// on all pages with class BlogPostSubClass:
// $this->owner->dbObject('Title') returns Title value correctly
// $this->owner->dbObject('Subtitle') returns nothing, same if called in BlogPostExtension
}
What am I missing here? The Subtitle field is editable and saves in the CMS, I just can’t access the value in it. Same fields are also missing when used in template in BlogPostSubClass.ss