123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- namespace App\Controller;
- use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
- use Symfony\Component\HttpFoundation\JsonResponse;
- use Symfony\Component\Routing\Annotation\Route;
- use Symfony\Component\HttpFoundation\Request;
- class VideothequePersonnelleController extends AbstractController
- {
- /**
- * @Route("/maliste/", name="videothequepersonnelle_maliste")
- */
- public function maListeAction (Request $request)
- {
- $films = $this
- ->getDoctrine()
- ->getManager()
- ->getRepository('App:Film')
- ->findTousFavoritesByUser($this->getUser());
- return $this->render('videotheque/liste.html.twig', array(
- 'listeFilms' => $films,
- 'titre' => 'Ma liste de films à voir'
- ));
- }
- /*public function maListeAction (Request $request)
- {
- $resultats = array();
- $user = $this->getUser();
- foreach ($user->getFilms() as $key => $film) {
- $resultats[$key] = $this->get('serializer')->serialize($film, 'json');
- }
- return new JsonResponse($resultats);
- }*/
- /**
- * @Route("/maliste/modifieravoir/", name="maliste_modifier_a_voir")
- * @param Request $request
- * @return JsonResponse
- */
- public function modifierFilmDansListeAction(Request $request)
- {
- $em = $this->getDoctrine()->getManager();
- $repo = $em->getRepository('App:Film');
- $film = $repo->find($request->request->get('id_film'));
- if ($request->isXmlHttpRequest())
- {
- $film->inverseUserWantToView($this->getUser());
- $em->flush();
- }
- /*$resultat = $this->get('serializer')->serialize($film, 'json');*/
- return new JsonResponse('OK');
- }
- /**
- * @Route("/maliste/modifiervus/", name="maliste_modifier_vus")
- * @param Request $request
- * @return JsonResponse
- */
- public function modifierFilmVusAction(Request $request)
- {
- $em = $this->getDoctrine()->getManager();
- $repo = $em->getRepository('App:Film');
- $film = $repo->find($request->request->get('id_film'));
- if ($request->isXmlHttpRequest())
- {
- $film->inverseUserWhoSeen($this->getUser());
- $em->flush();
- }
- /*$resultat = $this->get('serializer')->serialize($film, 'json');*/
- return new JsonResponse('OK');
- }
- }
|