mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
fix logic in activity entity
This commit is contained in:
parent
432b105be5
commit
f35479e4d2
@ -230,18 +230,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
public function addSocialAction(SocialAction $socialAction): self
|
public function addSocialAction(SocialAction $socialAction): self
|
||||||
{
|
{
|
||||||
$descendants = $socialAction->getDescendants();
|
$descendants = $socialAction->getDescendants();
|
||||||
$inCollection = false;
|
|
||||||
|
|
||||||
if(null != $descendants) {
|
if(count($descendants) > 0) {
|
||||||
foreach ($descendants as $d) {
|
foreach ($descendants as $d) {
|
||||||
$inCollection = $this->socialActions->contains($d);
|
$inCollection = $this->socialActions->contains($d);
|
||||||
|
if ($inCollection) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$inCollection = $this->socialActions->contains($socialAction);
|
if (!$this->socialActions->contains($socialAction)) {
|
||||||
}
|
$this->socialActions[] = $socialAction;
|
||||||
|
};
|
||||||
if(!$inCollection) {
|
|
||||||
$this->socialActions[] = $socialAction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@ -250,18 +250,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
|
|||||||
public function addSocialIssue(SocialIssue $socialIssue): self
|
public function addSocialIssue(SocialIssue $socialIssue): self
|
||||||
{
|
{
|
||||||
$descendants = $socialIssue->getDescendants();
|
$descendants = $socialIssue->getDescendants();
|
||||||
$inCollection = false;
|
|
||||||
|
|
||||||
if(null != $descendants) {
|
if(count($descendants) > 0) {
|
||||||
foreach ($descendants as $d) {
|
foreach ($descendants as $d) {
|
||||||
$inCollection = $this->socialIssues->contains($d);
|
$inCollection = $this->socialIssues->contains($d);
|
||||||
|
if ($inCollection) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$inCollection = $this->socialIssues->contains($socialIssue);
|
if (!$this->socialIssues->contains($socialIssue)) {
|
||||||
}
|
$this->socialIssues[] = $socialIssue;
|
||||||
|
};
|
||||||
if(!$inCollection) {
|
|
||||||
$this->socialIssues[] = $socialIssue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user