src/Controller/ServicesController.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Service;
  4. use App\Entity\Category;
  5. use App\Entity\Commentary;
  6. use Doctrine\ORM\EntityManagerInterface;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. class ServicesController extends AbstractController
  11. {
  12.     // ----------------TEST 1 ----PAGES "PARTICULIERS" ET "ENTREPRISES"------AFFICHAGE DU "SERVICE"-------------------------------------------------------------------------------------------------
  13.     /**
  14.      * @Route("/{category_title}/{service_title}_{id}", name="app_show_service", methods={"GET"})
  15.      */
  16.     public function showService(Service $serviceEntityManagerInterface $entityManager): Response
  17.     {
  18.         // $service = $entityManager->getRepository(Service::class)->findBy(['id'=> $service->getId()]);
  19.         
  20.         //   Test  20/05  Affichage des commentaires par service :  ci-dessous + 'commentaries'=> $commentaries,
  21.         $commentaries $entityManager->getRepository(Commentary::class)->findBy(['service'=> $service->getId()]);
  22.         return $this->render('services/show_service.html.twig', [
  23.             'service' => $service
  24.             'commentaries'=> $commentaries
  25.         ]);
  26.         
  27.     }
  28. }