PHP code example of id4v / menu-bundle

1. Go to this page and download the library: Download id4v/menu-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

id4v / menu-bundle example snippets


public function registerBundles()
    {
        $bundles = array(
        ...
        # if you haven't already this bundle
        new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
        ...
        new \Id4v\Bundle\MenuBundle\Id4vMenuBundle(),
        ...
        );
        return $bundles
    }

namespace AppBundle\Menu;

use Knp\Menu\FactoryInterface;
use Doctrine\ORM\EntityManager;
use Id4v\Bundle\MenuBundle\Builder\BaseMenuBuilder;

class AppMenuBuilder extends BaseMenuBuilder
{
    public function __construct(FactoryInterface $factory, EntityManager $em)
    {
        parent::__construct($factory, $em);
    }

    public function createMainMenu()
    {
        return $this->getSimpleMenu('main-menu');
    }
}