<?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\CircuitService;
use App\Form\CircuitType;
use App\Entity\Circuit;
/**
* Frontend: Circuit controller.
* @Route("/circuit", name="frontend_circuit")
*/
class CircuitController extends AbstractController
{
/**
* @var CircuitService
*/
private $CircuitService;
public function __construct(CircuitService $circuitService)
{
$this->CircuitService = $circuitService;
}
/**
* @Route("", name="_liste")
*/
public function getCircuits()
{
$circuits = $this->CircuitService->getCircuit(['statut' => true]);
return $this->render('circuit/list.html.twig', ['circuits' => $circuits]);
}
/**
* @Route("/{alias}", name="_detail")
*/
public function getCircuit($alias)
{
$circuit = $this->CircuitService->getCircuit(array('alias'=> $alias));
return $this->render('circuit/detail.html.twig', ['circuit' => $circuit[0]]);
}
}