src/Controller/Front/CompetitionController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use App\Entity\Competition;
  4. use App\Repository\CompetitionRepository;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. #[Route('/competition')]
  9. class CompetitionController extends AbstractController
  10. {
  11.     #[Route('/'name'front_competition_index'methods: ['GET'])]
  12.     public function index(CompetitionRepository $competitionRepository): Response
  13.     {
  14.         return $this->render('Front/competition/index.html.twig', [
  15.             'competitions' => $competitionRepository->findBy([], ['date' => 'ASC']),
  16.         ]);
  17.     }
  18.     #[Route('/{id}'name'front_competition_show'methods: ['GET'])]
  19.     public function show(Competition $competition): Response
  20.     {
  21.         return $this->render('Front/competition/show.html.twig', [
  22.             'competition' => $competition,
  23.         ]);
  24.     }
  25. }