Skip to content

Commit

Permalink
comments extension filters on Parent Class
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dunatron authored and robbieaverill committed Aug 14, 2019
1 parent f65f5b5 commit 617501e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Extensions/CommentsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ public function AllComments()
{
$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;
Expand Down

0 comments on commit 617501e

Please sign in to comment.