Commit efe86ca3 authored by dj3c1t's avatar dj3c1t

del HeaderMenu service

parent 078e54e4
Pipeline #52 skipped
......@@ -8,7 +8,7 @@ use Dj3c1t\AppBundle\Entity\DefaultConfiguration;
class HeaderController extends Controller {
public function displayAction() {
$header_menus = $this->get("dj3c1t_app.header_menus");
$dj3c1t_menus = $this->get("dj3c1t_app.menus");
$em = $this->getDoctrine()->getManager();
$configurationRepo = $em->getRepository("Dj3c1tAppBundle:Configuration");
if(!($site_title = $configurationRepo->getConfiguration("site_title"))) {
......@@ -18,7 +18,7 @@ class HeaderController extends Controller {
'Dj3c1tAppBundle::header.html.twig',
array(
"site_title" => $site_title,
"menu" => $header_menus->getHeaderMenu(),
"menu" => $dj3c1t_menus->getMenuByName('header'),
)
);
}
......
......@@ -13,13 +13,9 @@ services:
class: Dj3c1t\AppBundle\Service\Menus
arguments: ['@service_container']
dj3c1t_app.header_menus:
class: Dj3c1t\AppBundle\Service\HeaderMenus
arguments: ['@service_container']
gedmo.listener.timestampable:
class: Gedmo\Timestampable\TimestampableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ @annotation_reader ] ]
\ No newline at end of file
- [ setAnnotationReader, [ @annotation_reader ] ]
<?php
namespace Dj3c1t\AppBundle\Service;
use Symfony\Component\DependencyInjection\ContainerInterface as Container;
class HeaderMenus {
private $container;
public function __construct(Container $container) {
$this->container = $container;
}
public function getHeaderMenu() {
$em = $this->container->get('doctrine')->getManager();
$configurationRepo = $em->getRepository("Dj3c1tAppBundle:Configuration");
$menu = array();
if($menuJson = $configurationRepo->getConfiguration("header_menu")) {
$menu = json_decode($menuJson, true);
}
return $menu;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment