mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 22:04:23 +00:00
logic added to only keep youngest descendant. works for issue, seems not to for action
This commit is contained in:
parent
d0772fc306
commit
4ef2274803
@ -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