<?php
namespace App\Controller;
use App\Service\StaticData;
use App\Repository\PageHeaderRepository;
use Doctrine\ORM\EntityManagerInterface;
use App\Repository\GalleryAreaRepository;
use App\Repository\GalleryCategoryRepository;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class GalleryController extends AbstractController
{
public function __construct(EntityManagerInterface $manager, StaticData $statics)
{
$this->manager = $manager;
$this->statics = $statics->getStaticData();
}
/**
* @Route("/{_locale}/galerie", name="gallery_index")
*/
public function index(PageHeaderRepository $pageRepo, GalleryAreaRepository $areaRepo, GalleryCategoryRepository $categoryRepo): Response
{
$page = $pageRepo->findOneBy(['page' => 'gallery']);
$area = $areaRepo->findOneBy([]);
$categories = $categoryRepo->findBy([], ['position' => 'ASC']);
return $this->render('gallery/index.html.twig', [
'statics' => $this->statics['data'],
'page' => $page,
'area' => $area,
'categories' => $categories,
]);
}
}