<?php

namespace App\Twig;

use App\Entity\Site\Page;
use Lc\SovBundle\Doctrine\EntityManager;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;

/**
 *
 *
 * @author Fab
 */
class TwigExtension extends AbstractExtension
{
        
        
        private $container;
        private $vichHelper;
        private $liipCacheHelper;
        private $requestStack = false;
        private $em;
        private $mwCache;
        
        public function __construct(EntityManager $em)
        {
                $this->em = $em;
        }

        public function getFilters()
        {
                return array(

                );
        
        }

        public function getFunctions()
        {
                return array(

                        new TwigFunction('getPagesNav', array($this, 'getPagesNav'))
                );

        }


        public function getPagesNav()
        {
                $pageRepository = $this->em->getRepository(Page::class);

                //return $pageRepository->findByShowInMenu(1, array('position' => 'asc'));
                return $pageRepository->findBy(array(), array('position' => 'asc'));

        }


}
