add merge method

This commit is contained in:
2022-05-02 14:01:41 +02:00
parent c629dd79cb
commit acee0ade24
2 changed files with 18 additions and 2 deletions

View File

@@ -41,4 +41,20 @@ class PrivateCommentEmbeddable
return $this;
}
public function setComments($comments)
{
$this->comments = $comments;
return $this;
}
public function merge(PrivateCommentEmbeddable $newComment): self
{
$mergedComments = $newComment->getComments() + $this->getComments();
$this->setComments($mergedComments);
return $this;
}
}