mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
logic added to only keep youngest descendant. works for issue, seems not to for action
This commit is contained in:
parent
00a6ef0598
commit
988b67bd4b
@ -229,7 +229,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
|
|
||||||
public function addSocialAction(SocialAction $socialAction): self
|
public function addSocialAction(SocialAction $socialAction): self
|
||||||
{
|
{
|
||||||
if (!$this->socialActions->contains($socialAction)) {
|
$descendants = $socialAction->getDescendants();
|
||||||
|
$inCollection = false;
|
||||||
|
|
||||||
|
if(null != $descendants) {
|
||||||
|
foreach ($descendants as $d) {
|
||||||
|
$inCollection = $this->socialActions->contains($d);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$inCollection = $this->socialActions->contains($socialAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$inCollection) {
|
||||||
$this->socialActions[] = $socialAction;
|
$this->socialActions[] = $socialAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +249,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
|
|
||||||
public function addSocialIssue(SocialIssue $socialIssue): self
|
public function addSocialIssue(SocialIssue $socialIssue): self
|
||||||
{
|
{
|
||||||
if (!$this->socialIssues->contains($socialIssue)) {
|
$descendants = $socialIssue->getDescendants();
|
||||||
|
$inCollection = false;
|
||||||
|
|
||||||
|
if(null != $descendants) {
|
||||||
|
foreach ($descendants as $d) {
|
||||||
|
$inCollection = $this->socialIssues->contains($d);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$inCollection = $this->socialIssues->contains($socialIssue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$inCollection) {
|
||||||
$this->socialIssues[] = $socialIssue;
|
$this->socialIssues[] = $socialIssue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user