|
@@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|
|
|
|
|
class VideothequePersonnelleController extends AbstractController
|
|
|
{
|
|
|
- #[Route("/maliste/", name:"videothequepersonnelle_maliste")]
|
|
|
+ #[Route("/maliste", name:"videothequepersonnelle_maliste")]
|
|
|
public function maListeAction (Request $request, FilmRepository $repo, OptionsManager $options): Response
|
|
|
{
|
|
|
$films = $repo->findTousFavoritesByUser($this->getUser());
|
|
@@ -25,31 +25,25 @@ class VideothequePersonnelleController extends AbstractController
|
|
|
));
|
|
|
}
|
|
|
|
|
|
- #[Route("/maliste/modifieravoir/", name:"maliste_modifier_a_voir")]
|
|
|
+ #[Route("/maliste/modifieravoir", name:"maliste_modifier_a_voir", methods: ['PATCH'])]
|
|
|
public function modifierFilmDansListeAction(Request $request, EntityManagerInterface $em, FilmRepository $repo, FilmManager $filmManager): Response
|
|
|
{
|
|
|
$result = null;
|
|
|
- $film = $repo->find($request->request->get('id_film'));
|
|
|
- if ($request->isXmlHttpRequest())
|
|
|
- {
|
|
|
- $result = $filmManager->inverseUserWantToView($film);
|
|
|
- $em->flush();
|
|
|
- }
|
|
|
+ $film = $repo->find($request->toArray()['id_film']);
|
|
|
+ $result = $filmManager->inverseUserWantToView($film);
|
|
|
+ $em->flush();
|
|
|
/*$resultat = $this->get('serializer')->serialize($film, 'json');*/
|
|
|
return new JsonResponse((object)['newState' => $result]);
|
|
|
}
|
|
|
|
|
|
- #[Route("/maliste/modifiervus/", name:"maliste_modifier_vus")]
|
|
|
+ #[Route("/maliste/modifiervus", name:"maliste_modifier_vus", methods: ['PATCH'])]
|
|
|
public function modifierFilmVusAction(Request $request, FilmRepository $repo, EntityManagerInterface $em, FilmManager $filmManager): Response
|
|
|
{
|
|
|
$result = null;
|
|
|
|
|
|
- $film = $repo->find($request->request->get('id_film'));
|
|
|
- if ($request->isXmlHttpRequest())
|
|
|
- {
|
|
|
- $result = $filmManager->inverseUserWhoSeen($film);
|
|
|
- $em->flush();
|
|
|
- }
|
|
|
+ $film = $repo->find($request->toArray()['id_film']);
|
|
|
+ $result = $filmManager->inverseUserWhoSeen($film);
|
|
|
+ $em->flush();
|
|
|
return new JsonResponse((object)['newState' => $result]);
|
|
|
}
|
|
|
|