Menu/MenuBuilder.php
public function createMainMenu(Request $request)
    {
        $menu = $this->factory->createItem('root');

        $menu->setCurrentUri($request->getBaseUrl().$request->getPathInfo());

        // create menu from admin pool
        $admin_pool = $this->container->get('sonata.admin.pool');
        foreach ($admin_pool->getDashboardGroups() as $group) {
            $menu->addChild($group['label'], array('translationDomain'=>$group['label_catalogue']));
            foreach ($group['items'] as $admin) {
                if ( $admin->hasRoute('list') && $admin->isGranted('LIST') ) {
                    $menu[$group['label']]->addChild($admin->getLabel(), array('admin'=>$admin));
                }
            }
        }

        $dispatcher = $this->container->get('event_dispatcher');

        $event = new MenuCreateEvent($menu);
        $dispatcher->dispatch(MenuEvents::ADMIN_MENU_CREATE, $event);

        return $menu;
    }
public function createMainMenu(Request $request)
    {
        $menu = $this->factory->createItem('root');

        $menu->setCurrentUri($request->getBaseUrl().$request->getPathInfo());

        // create menu from admin pool
        $admin_pool = $this->container->get('sonata.admin.pool');
        foreach ($admin_pool->getDashboardGroups() as $group) {
            $menu->addChild($group['label'], array('translationDomain'=>$group['label_catalogue']));
            foreach ($group['items'] as $admin) {
                if ( $admin->hasRoute('list') && $admin->isGranted('LIST') ) {
                    $menu[$group['label']]->addChild($admin->getLabel(), array('admin'=>$admin));
                }
            }
        }

        $dispatcher = $this->container->get('event_dispatcher');

        $event = new MenuCreateEvent($menu);
        $dispatcher->dispatch(MenuEvents::ADMIN_MENU_CREATE, $event);

        return $menu;
    }
Create the main menu

@param Request $request [description]

@return [type]