<?php
namespace App\Controller\Frontend;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\String\Slugger\AsciiSlugger;
use Nelmio\ApiDocBundle\Annotation\Security;
use App\Service\EventService;
use App\Repository\EventRepository;
use App\Entity\Event;
/**
* Frontend: Event controller.
* @Route("/event", name="frontend_event")
*/
class EventController extends AbstractController
{
/**
* @var EventService
*/
private $EventService;
public function __construct(EventService $eventService)
{
$this->EventService = $eventService;
}
/**
* @Route("", name="_liste")
*/
public function getEvents(EventRepository $EventRepository)
{
$liste = $EventRepository->orderByStart();
return $this->render('event/list.html.twig', ['liste' => $liste]);
}
/**
* @Route("/{alias}", name="_detail")
*/
public function getEvent($alias)
{
setlocale(LC_TIME, "fr_FR");
$event = $this->EventService->getEvent(array('alias'=> $alias));
return $this->render('event/detail.html.twig', ['event' => $event[0]]);
}
}