/** * @param \Bigfoot\Bundle\NavigationBundle\Entity\Menu\Item $item * @param null $depth * @param bool $displayAll * * @return array|\Doctrine\Common\Collections\ArrayCollection */ public function getChildren(Menu\Item $item, $depth = null, $displayAll = false) { if (!($children = $item->getOrderedChildren())) { $menuConfig = $this->menuConfig; foreach ($menuConfig as $prefix => $config) { if ($item->getChildAttributeValueByName('entity') && $this->stringStartsWith($item->getChildAttributeValueByName('entity'), $prefix)) { $children = $this->generateChildren($config['entity'], $config['type'], $depth, $displayAll); break; } } } return $children; }