NavigationItem: Set the parent on a child in method setChildren()
refs #5600
This commit is contained in:
parent
c9050e2f21
commit
5efcb18fa0
|
@ -244,9 +244,9 @@ class NavigationItem implements Countable, IteratorAggregate
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the item's children
|
||||
* Return this item's children
|
||||
*
|
||||
* @return Navigation
|
||||
* @return Navigation
|
||||
*/
|
||||
public function getChildren()
|
||||
{
|
||||
|
@ -264,7 +264,7 @@ class NavigationItem implements Countable, IteratorAggregate
|
|||
}
|
||||
|
||||
/**
|
||||
* Set children
|
||||
* Set this item's 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');
|
||||
}
|
||||
|
||||
foreach ($children as $item) {
|
||||
$item->setParent($this);
|
||||
}
|
||||
|
||||
$this->children = $children;
|
||||
return $this;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue