src/Controller/DocteursController.php line 33

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Dentiste;
  4. use App\Repository\DentisteRepository;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class DocteursController extends AbstractController
  9. {   
  10.     private $dentistesRepository;
  11.     public function __construct(DentisteRepository $dentisteRepository)
  12.     {
  13.         $this->dentistesRepository $dentisteRepository;
  14.     }
  15.     #[Route('/dentistes'name'dentistes')]
  16.     public function index(): Response
  17.     {
  18.         $dentistes $this->dentistesRepository->findAll();
  19.         dd($dentistes);    
  20.         return $this->render('dentistes.html.twig', [
  21.             'dentistes' => $dentistes
  22.         ]);
  23.     }
  24.     #[Route('/dentiste/{name}'name'dentiste')]
  25.     public function show(string $name): Response
  26.     {
  27.         $dentiste $this->dentistesRepository->findOneByName($name);
  28.         $dentistes $this->dentistesRepository->findAll();
  29.         
  30.         return $this->render('docteurs/dentiste.html.twig', [
  31.             'dentistes'=> $dentistes,
  32.             'dentiste' => $dentiste
  33.         ]);
  34.     }
  35. }