From a78c62789c88b43f982700d744a14cdf028673cd Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 8 Apr 2022 18:56:37 +0200 Subject: [PATCH] if parent in collection replace with child, problem, sibling isn't added --- src/Bundle/ChillActivityBundle/Entity/Activity.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index ac67a73e4..f157401a7 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -231,6 +231,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac public function addSocialAction(SocialAction $socialAction): self { $descendants = $socialAction->getDescendantsWithThis(); + $parent = $socialAction->getParent(); + + dump($this->socialActions); + dump($parent); + + $parentKey = array_search($parent, $this->socialActions->toArray()); + + if (null !== $parentKey) { + dump(true); + $this->socialActions[$parentKey] = $socialAction; + // return $this; + } if (count($descendants) > 0) { foreach ($descendants as $d) {