src/Controller/NosServiceController.php line 20

  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\NosService;
  4. use Doctrine\ORM\EntityManagerInterface;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class NosServiceController extends AbstractController
  9. {
  10.     private $entityManager;
  11.     public function __construct(EntityManagerInterface $entityManager)
  12.     {
  13.         $this->entityManager $entityManager;
  14.     }
  15.     #[Route('/nos/service'name'service')]
  16.     public function index(): Response
  17.     {
  18.         $service $this->entityManager->getRepository(NosService::class)->findAll();
  19.         return $this->render('nos_service/index.html.twig', [
  20.             'services' => $service,
  21.         ]);
  22.     }
  23. }