src/Controller/Front/EventController.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use App\Entity\Event;
  4. use App\Repository\EventRepository;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class EventController extends AbstractController
  9. {
  10.     #[Route('/activite/{slug}'name'event_show')]
  11.     public function show(
  12.         Event $event
  13.     ): Response
  14.     {
  15.         return $this->render('front/page/event/show.html.twig', [
  16.             "event" => $event,
  17.         ]);
  18.     }
  19.     #[Route('/activite'name'event_index')]
  20.     public function showAllEvents(
  21.         EventRepository $eventRepository,
  22.     ): Response
  23.     {
  24.         $events $eventRepository->findAll();
  25.         return $this->render('front/page/event/index.html.twig', [
  26.             "events" => $events,
  27.         ]);
  28.     }
  29. }