comments extension filters on Parent Class

This allows both pages and DataObjects to have comments without the ParentID clashing and showing comments on a page where the ParentID is the Same as a DataObjects or even two DataObjects having the sameID
This commit is contained in:
Heath Dunlop 2019-05-16 13:46:28 +12:00 committed by Robbie Averill
parent f65f5b5697
commit 617501efed

View File

@ -254,7 +254,10 @@ class CommentsExtension extends DataExtension
{
$order = $this->owner->getCommentsOption('order_comments_by');
$comments = Comment::get()
->filter('ParentID', $this->owner->ID)
->filter([
'ParentID' => $this->owner->ID,
'ParentClass' => $this->owner->ClassName,
])
->sort($order);
$this->owner->extend('updateAllComments', $comments);
return $comments;