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'); } }