1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-18 13:10:08 -07:00
2017-05-22 15:37:02 +02:00

54 lines
1.1 KiB
PHP

<?php
namespace AppBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\HttpFoundation\RequestStack;
class Builder
{
/** @var FactoryInterface */
private $factory;
/** @var RequestStack */
private $requestStack;
/**
* Builder constructor.
*
* @param FactoryInterface $factory
* @param RequestStack $requestStack
*/
public function __construct(FactoryInterface $factory, RequestStack $requestStack)
{
$this->factory = $factory;
$this->requestStack = $requestStack;
}
public function mainMenu(array $options)
{
$request = $this->requestStack->getCurrentRequest();
$menu = $this->factory->createItem('root', [
'route' => 'homepage',
]);
$menu->addChild('Home', [
'route' => 'homepage',
]);
$models = $menu->addChild('Models', [
'route' => 'model_index',
]);
$models->addChild('Colors', [
'route' => 'color_index',
]);
$menu->addChild('Sets', [
'route' => 'set_index',
]);
return $menu;
}
}