src/Controller/Frontend/CircuitController.php line 36

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\CircuitService;
  12. use App\Form\CircuitType;
  13. use App\Entity\Circuit;
  14. /**
  15.  * Frontend: Circuit controller.
  16.  * @Route("/circuit", name="frontend_circuit")
  17. */
  18. class CircuitController extends AbstractController
  19. {
  20.     /**
  21.      * @var CircuitService
  22.      */
  23.     private $CircuitService;
  24.     public function __construct(CircuitService $circuitService)
  25.     {
  26.         $this->CircuitService $circuitService;
  27.     }
  28.     /**
  29.      * @Route("", name="_liste")
  30.      */
  31.     public function getCircuits()
  32.     {
  33.         $circuits $this->CircuitService->getCircuit(['statut' => true]);
  34.         return $this->render('circuit/list.html.twig', ['circuits' => $circuits]);
  35.     }
  36.     /**
  37.      * @Route("/{alias}",  name="_detail")
  38.      */
  39.     public function getCircuit($alias)
  40.     {
  41.         $circuit $this->CircuitService->getCircuit(array('alias'=> $alias));
  42.         return $this->render('circuit/detail.html.twig',  ['circuit' => $circuit[0]]);
  43.     }
  44. }