src/Controller/FrontGalleryController.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Gallery;
  4. use App\Entity\Images;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  7. use Symfony\Component\HttpFoundation\Response;
  8. use Symfony\Component\Routing\Annotation\Route;
  9. class FrontGalleryController extends AbstractController
  10. {
  11.     /**
  12.      * @Route("/gallery", name="app_front_gallery")
  13.      */
  14.     public function index(ManagerRegistry $doctrine): Response
  15.     {
  16.         $images = $doctrine->getRepository(Gallery::class)->findAll();
  17.         $banner = $doctrine->getRepository(Images::class)->findOneBy(['type' => 'banner2']);
  18.         return $this->render('front_gallery/index.html.twig', [
  19.             'titlePage' => 'Galeria',
  20.             'images' => $images,
  21.             'banner' => $banner,
  22.         ]);
  23.     }
  24. }