src/Kunstmaan/MenuBundle/Twig/MenuTwigExtension.php
public function getMenuItems($name, $lang)
    {
        /** @var MenuItem $menuRepo */
        $arrayResult = $this->repository->getMenuItemsForLanguage($name, $lang);

        // Make sure the parent item is not offline
        $foundIds = array();
        foreach ($arrayResult as $array) {
            $foundIds[] = $array['id'];
        }
        foreach ($arrayResult as $key => $array) {
            if (!is_null($array['parent']) && !in_array($array['parent']['id'], $foundIds)) {
                unset($arrayResult[$key]);
            }
        }

        return $arrayResult;
    }
public function getMenuItems($name, $lang)
    {
        /** @var MenuItem $menuRepo */
        $arrayResult = $this->repository->getMenuItemsForLanguage($name, $lang);

        // Make sure the parent item is not offline
        $foundIds = array();
        foreach ($arrayResult as $array) {
            $foundIds[] = $array['id'];
        }
        foreach ($arrayResult as $key => $array) {
            if (!is_null($array['parent']) && !in_array($array['parent']['id'], $foundIds)) {
                unset($arrayResult[$key]);
            }
        }

        return $arrayResult;
    }
public function getMenuItems ( $ name , $ lang ) { /** @var MenuItem $menuRepo */ $ arrayResult = $ this -> repository -> getMenuItemsForLanguage ( $ name , $ lang ) ; // Make sure the parent item is not offline $ foundIds = array ( ) ; foreach ( $ arrayResult as $ array ) { $ foundIds [ ] = $ array [ 'id' ] ; } foreach ( $ arrayResult as $ key => $ array ) { if ( ! is_null ( $ array [ 'parent' ] ) && ! in_array ( $ array [ 'parent' ] [ 'id' ] , $ foundIds ) ) { unset ( $ arrayResult [ $ key ] ) ; } } return $ arrayResult ; }
Get an array with menu items of a menu.

@param string $name
@param string $lang

@return array
Get an array with menu items of a menu .