add route for comment + track update/creation of entities

This commit is contained in:
2021-05-13 17:25:24 +02:00
parent 05798688d0
commit 3e85529468
9 changed files with 229 additions and 4 deletions

View File

@@ -117,7 +117,9 @@ class AccompanyingPeriod
* @var Collection
*
* @ORM\OneToMany(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod\Comment",
* mappedBy="accompanyingPeriod"
* mappedBy="accompanyingPeriod",
* cascade={"persist", "remove"},
* orphanRemoval=true
* )
* @Groups({"read"})
*/
@@ -350,12 +352,14 @@ class AccompanyingPeriod
public function addComment(Comment $comment): self
{
$this->comments[] = $comment;
$comment->setAccompanyingPeriod($this);
return $this;
}
public function removeComment(Comment $comment): void
{
$comment->setAccompanyingPeriod(null);
$this->comments->removeElement($comment);
}