|
@@ -2,10 +2,8 @@
|
|
|
|
|
|
namespace App\Controller;
|
|
|
|
|
|
-use App\Dto\FiltersDTO;
|
|
|
use App\Entity\Commentaire;
|
|
|
use App\Entity\Realisateur;
|
|
|
-use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
|
use Symfony\Component\Routing\Annotation\Route;
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
@@ -13,7 +11,6 @@ use App\Entity\Film;
|
|
|
use App\Entity\Genre;
|
|
|
use App\Form\CommentaireType;
|
|
|
use App\Form\FilmType;
|
|
|
-use App\Form\FiltersType;
|
|
|
use App\Repository\CommentaireRepository;
|
|
|
use App\Repository\FilmRepository;
|
|
|
use App\Repository\GenreRepository;
|
|
@@ -27,23 +24,13 @@ use Symfony\Component\Form\FormFactoryInterface;
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
|
|
|
|
|
-class VideothequeController extends AbstractController
|
|
|
+class VideothequeController extends FilmAbstractController
|
|
|
{
|
|
|
#[Route("/", name: "videotheque_liste")]
|
|
|
public function listeAction(Request $request, FilmRepository $filmRepository, OptionsManager $options): Response
|
|
|
{
|
|
|
- $session = $request->getSession();
|
|
|
-
|
|
|
- $filterDto = $session->get('filters', new FiltersDTO());
|
|
|
- $filtersForm = $this->createForm(FiltersType::class, $filterDto);
|
|
|
-
|
|
|
- $filtersForm->handleRequest($request);
|
|
|
-
|
|
|
- if ($filtersForm->isSubmitted() && $filtersForm->isValid()) {
|
|
|
- $session->set('filters', $filterDto);
|
|
|
- }
|
|
|
- $filters = $filtersForm->getData();
|
|
|
- $listeFilms = $filmRepository->findTous($filters->toArray());
|
|
|
+ $filtersForm = $this->formPagination($request);
|
|
|
+ $listeFilms = $filmRepository->findTous($filtersForm->getData()->toArray());
|
|
|
|
|
|
return $this->render('videotheque/liste_'.$options->vue().'.html.twig', array(
|
|
|
'listeFilms' => $listeFilms,
|
|
@@ -53,7 +40,7 @@ class VideothequeController extends AbstractController
|
|
|
}
|
|
|
|
|
|
#[Route("/prochaines-sorties", name: "prochaines_sorties")]
|
|
|
- public function prochainesSorties(Request $request, FilmRepository $repo, OptionsManager $options): Response
|
|
|
+ public function prochainesSorties(FilmRepository $repo, OptionsManager $options): Response
|
|
|
{
|
|
|
$listeFilms = $repo->findProchaines();
|
|
|
|
|
@@ -64,20 +51,10 @@ class VideothequeController extends AbstractController
|
|
|
}
|
|
|
|
|
|
#[Route("/liste-by/{id}", name: "videotheque_listepargenre")]
|
|
|
- public function listeParGenreAction(Request $request, Genre $genre, FilmRepository $repo, OptionsManager $options): Response
|
|
|
+ public function listeParGenreAction(Request $request, Genre $genre, FilmRepository $repo, OptionsManager $options): Response
|
|
|
{
|
|
|
- $session = $request->getSession();
|
|
|
-
|
|
|
- $filterDto = $session->get('filters', new FiltersDTO());
|
|
|
- $filtersForm = $this->createForm(FiltersType::class, $filterDto);
|
|
|
-
|
|
|
- $filtersForm->handleRequest($request);
|
|
|
-
|
|
|
- if ($filtersForm->isSubmitted() && $filtersForm->isValid()) {
|
|
|
- $session->set('filters', $filterDto);
|
|
|
- }
|
|
|
- $filters = $filtersForm->getData();
|
|
|
- $films = $repo->findFilmWithGenre([$genre->getName()], $filters->toArray());
|
|
|
+ $filtersForm = $this->formPagination($request);
|
|
|
+ $films = $repo->findFilmWithGenre([$genre->getName()], $filtersForm->getData()->toArray());
|
|
|
|
|
|
return $this->render('videotheque/liste_'.$options->vue().'.html.twig', array(
|
|
|
'listeFilms' => $films,
|
|
@@ -89,18 +66,8 @@ class VideothequeController extends AbstractController
|
|
|
#[Route("/liste-by_real/{id}", name: "videotheque_listeparreal")]
|
|
|
public function listeParRealisateurAction(Request $request, Realisateur $realisateur, FilmRepository $repo, OptionsManager $options): Response
|
|
|
{
|
|
|
- $session = $request->getSession();
|
|
|
-
|
|
|
- $filterDto = $session->get('filters', new FiltersDTO());
|
|
|
- $filtersForm = $this->createForm(FiltersType::class, $filterDto);
|
|
|
-
|
|
|
- $filtersForm->handleRequest($request);
|
|
|
-
|
|
|
- if ($filtersForm->isSubmitted() && $filtersForm->isValid()) {
|
|
|
- $session->set('filters', $filterDto);
|
|
|
- }
|
|
|
- $filters = $filtersForm->getData();
|
|
|
- $films = $repo->findFilmWithReal([$realisateur->getNomComplet()], $filters->toArray());
|
|
|
+ $filtersForm = $this->formPagination($request);
|
|
|
+ $films = $repo->findFilmWithReal([$realisateur->getNomComplet()], $filtersForm->getData()->toArray());
|
|
|
|
|
|
return $this->render('videotheque/liste_'.$options->vue().'.html.twig', array(
|
|
|
'listeFilms' => $films,
|