From ea21f2d9c4070fa98341a056700e6d9871c1acea Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 16 Mar 2022 11:55:19 +0100 Subject: [PATCH] improvement, but still not correct --- .../ChillActivityBundle/Entity/Activity.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index f183ced60..db16ac9f6 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -235,15 +235,13 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac if (count($descendants) > 0) { foreach ($descendants as $d) { $inCollection = $this->socialActions->contains($d); - if ($inCollection) { return $this; } } - } else { - if (!$this->socialActions->contains($socialAction)) { - $this->socialActions[] = $socialAction; - } + } + if (!$this->socialActions->contains($socialAction)) { + $this->socialActions[] = $socialAction; } return $this; @@ -256,15 +254,14 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac if (count($descendants) > 0) { foreach ($descendants as $d) { $inCollection = $this->socialIssues->contains($d); - if ($inCollection) { return $this; } } - } else { - if (!$this->socialIssues->contains($socialIssue)) { - $this->socialIssues[] = $socialIssue; - } + } + + if (!$this->socialIssues->contains($socialIssue)) { + $this->socialIssues[] = $socialIssue; } return $this;