admin: fix adding of evaluation to social action

This commit is contained in:
nobohan 2022-05-25 11:46:03 +02:00
parent bc410b02e7
commit 2ac78a12db

View File

@ -46,10 +46,8 @@ class SocialAction
private $desactivationDate; private $desactivationDate;
/** /**
* @ORM\ManyToMany( * @ORM\ManyToMany(targetEntity=Evaluation::class, inversedBy="socialActions")
* targetEntity=Evaluation::class, * @ORM\JoinTable(name="chill_person_social_work_evaluation_action")
* mappedBy="socialActions"
* )
*/ */
private Collection $evaluations; private Collection $evaluations;
@ -110,6 +108,15 @@ class SocialAction
return $this; return $this;
} }
public function addEvaluation(Evaluation $evaluation): self
{
if (!$this->evaluations->contains($evaluation)) {
$this->evaluations[] = $evaluation;
}
return $this;
}
public function addGoal(Goal $goal): self public function addGoal(Goal $goal): self
{ {
if (!$this->goals->contains($goal)) { if (!$this->goals->contains($goal)) {
@ -300,6 +307,13 @@ class SocialAction
return $this; return $this;
} }
public function removeEvaluation(Evaluation $evaluation): self
{
$this->evaluations->removeElement($evaluation);
return $this;
}
public function removeGoal(Goal $goal): self public function removeGoal(Goal $goal): self
{ {
$this->goals->removeElement($goal); $this->goals->removeElement($goal);