Fixed: usage of owner side / inversed side on SocialAction / Evaluation

In a ManyToMany relationship, doctrine does take care only of the owning
side of a relationship to inspect changes.

([see
documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/unitofwork-associations.html#important-concepts))

This commit mark as "internal" the methods add/removeSocialAction on the
inversed side (`Evaluation`) and let the methods add/removeEvaluation
on the owning side (`SocialAction`) update the inversed side.

The usage is also adapted into SocialWorkMetadata's importer.
This commit is contained in:
2022-10-10 13:47:17 +02:00
parent 2229266347
commit 69704e5211
3 changed files with 11 additions and 1 deletions

View File

@@ -112,6 +112,7 @@ class SocialAction
{
if (!$this->evaluations->contains($evaluation)) {
$this->evaluations[] = $evaluation;
$evaluation->addSocialAction($this);
}
return $this;
@@ -310,6 +311,7 @@ class SocialAction
public function removeEvaluation(Evaluation $evaluation): self
{
$this->evaluations->removeElement($evaluation);
$evaluation->removeSocialAction($this);
return $this;
}