From 2ac78a12db30c8ad8191ba9f2fff9237a3971264 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 25 May 2022 11:46:03 +0200 Subject: [PATCH] admin: fix adding of evaluation to social action --- .../Entity/SocialWork/SocialAction.php | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index 904950489..fbd271b44 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -46,10 +46,8 @@ class SocialAction private $desactivationDate; /** - * @ORM\ManyToMany( - * targetEntity=Evaluation::class, - * mappedBy="socialActions" - * ) + * @ORM\ManyToMany(targetEntity=Evaluation::class, inversedBy="socialActions") + * @ORM\JoinTable(name="chill_person_social_work_evaluation_action") */ private Collection $evaluations; @@ -110,6 +108,15 @@ class SocialAction return $this; } + public function addEvaluation(Evaluation $evaluation): self + { + if (!$this->evaluations->contains($evaluation)) { + $this->evaluations[] = $evaluation; + } + + return $this; + } + public function addGoal(Goal $goal): self { if (!$this->goals->contains($goal)) { @@ -300,6 +307,13 @@ class SocialAction return $this; } + public function removeEvaluation(Evaluation $evaluation): self + { + $this->evaluations->removeElement($evaluation); + + return $this; + } + public function removeGoal(Goal $goal): self { $this->goals->removeElement($goal);