switch to using getDescendantsWithThis()

This commit is contained in:
Julie Lenaerts 2022-03-22 13:45:20 +01:00
parent ea21f2d9c4
commit f09870931c
3 changed files with 7 additions and 10 deletions

View File

@ -230,7 +230,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
public function addSocialAction(SocialAction $socialAction): self public function addSocialAction(SocialAction $socialAction): self
{ {
$descendants = $socialAction->getDescendants(); $descendants = $socialAction->getDescendantsWithThis();
if (count($descendants) > 0) { if (count($descendants) > 0) {
foreach ($descendants as $d) { foreach ($descendants as $d) {
@ -240,16 +240,14 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
} }
} }
} }
if (!$this->socialActions->contains($socialAction)) {
$this->socialActions[] = $socialAction;
}
$this->socialActions[] = $socialAction;
return $this; return $this;
} }
public function addSocialIssue(SocialIssue $socialIssue): self public function addSocialIssue(SocialIssue $socialIssue): self
{ {
$descendants = $socialIssue->getDescendants(); $descendants = $socialIssue->getDescendantsWithThis();
if (count($descendants) > 0) { if (count($descendants) > 0) {
foreach ($descendants as $d) { foreach ($descendants as $d) {
@ -260,9 +258,8 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
} }
} }
if (!$this->socialIssues->contains($socialIssue)) { $this->socialIssues[] = $socialIssue;
$this->socialIssues[] = $socialIssue;
}
return $this; return $this;
} }

View File

@ -169,7 +169,7 @@ class SocialAction
} }
/** /**
* @return Collection|self[] All the descendants with the current entity (this) * @return Collection|self[] All the descendants including the current entity (this)
*/ */
public function getDescendantsWithThis(): Collection public function getDescendantsWithThis(): Collection
{ {

View File

@ -202,7 +202,7 @@ class SocialIssue
} }
/** /**
* @return Collection|self[] All the descendants with the current entity (this) * @return Collection|self[] All the descendants including the current entity (this)
*/ */
public function getDescendantsWithThis(): Collection public function getDescendantsWithThis(): Collection
{ {