src/Controller/Frontend/EventController.php line 45

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Frontend;
  3. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\HttpFoundation\RedirectResponse;
  9. use Symfony\Component\String\Slugger\AsciiSlugger;
  10. use Nelmio\ApiDocBundle\Annotation\Security;
  11. use App\Service\EventService;
  12. use App\Repository\EventRepository;
  13. use App\Entity\Event;
  14. /**
  15.  * Frontend: Event controller.
  16.  * @Route("/event", name="frontend_event")
  17. */
  18. class EventController extends AbstractController
  19. {
  20.     /**
  21.      * @var EventService
  22.      */
  23.     private $EventService;
  24.     public function __construct(EventService $eventService)
  25.     {
  26.         $this->EventService $eventService;
  27.     }
  28.     /**
  29.      * @Route("", name="_liste")
  30.      */
  31.     public function getEvents(EventRepository $EventRepository)
  32.     {
  33.         $liste $EventRepository->orderByStart();
  34.         return $this->render('event/list.html.twig', ['liste' => $liste]);
  35.     }
  36.     /**
  37.      * @Route("/{alias}",  name="_detail")
  38.      */
  39.     public function getEvent($alias)
  40.     {
  41.         setlocale(LC_TIME"fr_FR");
  42.         $event $this->EventService->getEvent(array('alias'=> $alias));
  43.         return $this->render('event/detail.html.twig',  ['event' => $event[0]]);
  44.     }
  45. }