NavigationItem: Set the parent on a child in method setChildren()
refs #5600
This commit is contained in:
parent
c9050e2f21
commit
5efcb18fa0
|
@ -244,7 +244,7 @@ class NavigationItem implements Countable, IteratorAggregate
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the item's children
|
* Return this item's children
|
||||||
*
|
*
|
||||||
* @return Navigation
|
* @return Navigation
|
||||||
*/
|
*/
|
||||||
|
@ -264,7 +264,7 @@ class NavigationItem implements Countable, IteratorAggregate
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set children
|
* Set this item's children
|
||||||
*
|
*
|
||||||
* @param array|Navigation $children
|
* @param array|Navigation $children
|
||||||
*
|
*
|
||||||
|
@ -278,6 +278,10 @@ class NavigationItem implements Countable, IteratorAggregate
|
||||||
throw new InvalidArgumentException('Argument $children must be of type array or Navigation');
|
throw new InvalidArgumentException('Argument $children must be of type array or Navigation');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($children as $item) {
|
||||||
|
$item->setParent($this);
|
||||||
|
}
|
||||||
|
|
||||||
$this->children = $children;
|
$this->children = $children;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue