mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
add merge method
This commit is contained in:
parent
c629dd79cb
commit
acee0ade24
@ -41,4 +41,20 @@ class PrivateCommentEmbeddable
|
|||||||
|
|
||||||
return $this;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\PrivateCommentEmbeddable", columnPrefix="privateComment_")
|
* @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;
|
private PrivateCommentEmbeddable $privateComment;
|
||||||
|
|
||||||
@ -521,7 +521,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
|
|||||||
|
|
||||||
public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self
|
public function setPrivateComment(PrivateCommentEmbeddable $privateComment): self
|
||||||
{
|
{
|
||||||
$this->privateComment = $privateComment;
|
$this->privateComment->merge($privateComment);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user