diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php index ea5df8fe0..bb393a3b5 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialAction.php @@ -389,6 +389,8 @@ class SocialAction { $this->parent = $parent; + $parent->addChild($this); + return $this; } diff --git a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php index d36642977..8708e34f3 100644 --- a/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php +++ b/src/Bundle/ChillPersonBundle/Entity/SocialWork/SocialIssue.php @@ -71,11 +71,15 @@ class SocialIssue $this->socialActions = new ArrayCollection(); } + /** + * @internal use @see{SocialIssue::setParent} instead + * @param SocialIssue $child + * @return $this + */ public function addChild(self $child): self { if (!$this->children->contains($child)) { $this->children[] = $child; - $child->setParent($this); } return $this; @@ -216,10 +220,10 @@ class SocialIssue } /** - * @param Collection|SocialIssue[] $socialIssues + * @param array|SocialIssue[] $socialIssues * @return Collection */ - public static function getDescendantsWithThisForIssues(Collection $socialIssues): Collection + public static function getDescendantsWithThisForIssues(array $socialIssues): Collection { $unique = []; @@ -351,6 +355,8 @@ class SocialIssue { $this->parent = $parent; + $parent->addChild($this); + return $this; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Entity/SocialWork/SocialActionTest.php b/src/Bundle/ChillPersonBundle/Tests/Entity/SocialWork/SocialActionTest.php index 2e0b64d6d..804ea2b1b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Entity/SocialWork/SocialActionTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Entity/SocialWork/SocialActionTest.php @@ -50,4 +50,4 @@ final class SocialActionTest extends TestCase $this->assertNotContains($unrelatedB, $actual); } -} \ No newline at end of file +}