diff --git a/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php index 70374749c..f3e35bb1f 100644 --- a/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php +++ b/src/Bundle/ChillMainBundle/Entity/Embeddable/PrivateCommentEmbeddable.php @@ -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; + } } diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index fd1156e01..8ea1028f8 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -138,7 +138,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_") - * @Serializer\Groups({"read", "accompanying_period_work:edit", "docgen:read"}) + * @Serializer\Groups({"read", "accompanying_period_work:edit"}) */ private PrivateCommentEmbeddable $privateComment; @@ -521,7 +521,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self { - $this->privateComment = $privateComment; + $this->privateComment->merge($privateComment); return $this; }