if parent in collection replace with child, problem, sibling isn't added

This commit is contained in:
Julie Lenaerts 2022-04-08 18:56:37 +02:00
parent 68671e297c
commit a78c62789c

View File

@ -231,6 +231,18 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
public function addSocialAction(SocialAction $socialAction): self
{
$descendants = $socialAction->getDescendantsWithThis();
$parent = $socialAction->getParent();
dump($this->socialActions);
dump($parent);
$parentKey = array_search($parent, $this->socialActions->toArray());
if (null !== $parentKey) {
dump(true);
$this->socialActions[$parentKey] = $socialAction;
// return $this;
}
if (count($descendants) > 0) {
foreach ($descendants as $d) {