src/Controller/GalleryController.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Service\StaticData;
  4. use App\Repository\PageHeaderRepository;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. use App\Repository\GalleryAreaRepository;
  7. use App\Repository\GalleryCategoryRepository;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  11. class GalleryController extends AbstractController
  12. {
  13.     public function __construct(EntityManagerInterface $managerStaticData $statics)
  14.     {
  15.         $this->manager $manager;
  16.         $this->statics $statics->getStaticData();
  17.     }
  18.     
  19.     /**
  20.      * @Route("/{_locale}/galerie", name="gallery_index")
  21.      */
  22.     public function index(PageHeaderRepository $pageRepoGalleryAreaRepository $areaRepoGalleryCategoryRepository $categoryRepo): Response
  23.     {
  24.         $page       $pageRepo->findOneBy(['page' => 'gallery']);
  25.         $area       $areaRepo->findOneBy([]);
  26.         $categories $categoryRepo->findBy([], ['position' => 'ASC']);
  27.         return $this->render('gallery/index.html.twig', [
  28.             'statics' => $this->statics['data'],
  29.             'page' => $page,
  30.             'area' => $area,
  31.             'categories' => $categories,
  32.         ]);
  33.     }
  34. }