src/Controller/CategoryServicesController.php line 21

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 CategoryServicesController extends AbstractController
  11. {
  12. // ----------------TEST 1 ----PAGES "PARTICULIERS" ET "ENTREPRISES"------AFFICHAGE DES SERVICES DE LA CATEGORIE"-------------------------------------------------------------------------------------------------
  13.     
  14.     /**
  15.      * @Route("/{category_title}_{id}", name="app_show_services_from_category", methods={"GET"})
  16.      */
  17.     public function showServicesFromCategory(Category $categoryEntityManagerInterface $entityManager) : Response
  18.     {
  19.         $services $entityManager->getRepository(Service::class)->findBy(['category'=> $category->getId()]); 
  20.         return $this->render('services/show_services_from_category.html.twig', [
  21.             'services' => $services,
  22.             'category' =>$category
  23.         ]);
  24.     }
  25. }