for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Lug package.
*
* (c) Eric GELOEN <[email protected]>
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code.
*/
namespace Lug\Bundle\UiBundle\Menu;
use Knp\Menu\FactoryInterface;
use Knp\Menu\ItemInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* @author GeLo <[email protected]>
abstract class AbstractMenuBuilder implements MenuBuilderInterface
{
* @var FactoryInterface
private $factory;
* @var EventDispatcherInterface
private $eventDispatcher;
* @param FactoryInterface $factory
* @param EventDispatcherInterface $eventDispatcher
public function __construct(FactoryInterface $factory, EventDispatcherInterface $eventDispatcher)
$this->factory = $factory;
$this->eventDispatcher = $eventDispatcher;
}
* @return ItemInterface
public function create()
$this->eventDispatcher->dispatch(MenuBuilderEvents::BUILD, $event = new MenuBuilderEvent(
$this->factory,
$this->factory->createItem($this->getName())
));
return $event->getItem();