src/Controller/FrontProductController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Repository\ActuRepository;
  4. use App\Repository\EventRepository;
  5. use App\Repository\ProductRepository;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. #[Route('/ateliers-et-formations')]
  10. class FrontProductController extends AbstractController
  11. {
  12.     #[Route('/{slug}'name'front_product_details')]
  13.     public function index(ProductRepository $productRepository$slugActuRepository $actuRepositoryEventRepository $eventRepository): Response
  14.     {
  15.         $product $productRepository->findOneBy(['slug' => $slug]);
  16.         $productFutureEvents $eventRepository->findAllFutureByProduct($product);
  17.         return $this->render('front_workshop/index.html.twig', [
  18.             'current_menu' => '',
  19.             'product' => $product,
  20.             'futureEvents' => $productFutureEvents,
  21.             'actuItems' => $actuRepository->findAll()
  22.         ]);
  23.     }
  24. }