silverstripe-blog
silverstripe-blog copied to clipboard
$this->Tags()->relation('BlogPosts') doesn't work
Currently I want to build a page exension that has a manymany relation to BlogTag so I can display related blog posts on other pages.
Unfortunately $this->Tags()->relation('BlogPosts') does not work, cause DataList::relation() tries to put some IDs when calling BlogTag::BlogPosts(), which is ignored by the BlogObject trait.
Fix in BlogObject:
/**
* @return DataList
*/
public function BlogPosts($id = null)
{
$blogPosts = parent::BlogPosts($id);
$this->extend('updateGetBlogPosts', $blogPosts);
return $blogPosts;
}
PRs:
- [ ] https://github.com/silverstripe/silverstripe-blog/pull/621
Hi! Thank you for reporting this. Would you like to make a Pull Request?
@dnsl48 I acceidently made a pull request against my own fork. Now fixed.
The PR linked in the description was merged in 2020 - I assume that fixed the bug.