src/Controller/HomeController.php line 24

  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Banner;
  4. use App\Entity\Client;
  5. use App\Entity\NosService;
  6. use App\Entity\ProposNous;
  7. use Doctrine\ORM\EntityManagerInterface;
  8. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  9. use Symfony\Component\HttpFoundation\Response;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. class HomeController extends AbstractController
  12. {
  13.     private $entityManager;
  14.     public function __construct(EntityManagerInterface $entityManager)
  15.     {
  16.         $this->entityManager $entityManager;
  17.     }
  18.     #[Route('/'name'home')]
  19.     public function index(): Response
  20.     {
  21.         $banner $this->entityManager->getRepository(Banner::class)->findByStatus(1);
  22.         $service $this->entityManager->getRepository(NosService::class)->findByStatut(1);
  23.         $client $this->entityManager->getRepository(Client::class)->findByStatut(1);
  24.         $about $this->entityManager->getRepository(ProposNous::class)->findByStatutLimit(1);
  25.         return $this->render('home/index.html.twig', [
  26.             'banners' => $banner,
  27.             'services' => $service,
  28.             'clients'=> $client,
  29.             'abouts'=> $about,
  30.         ]);
  31.     }
  32. }