getDoctrine() ->getManager(); // collect parameters for filter $params = []; $params['person'] = $person; $singleTasks = $this->get('chill_task.single_task_repository') ->findByParameters($params, $this->getUser()); return $this->render('ChillTaskBundle:Task:index.html.twig', [ 'single_tasks' => $singleTasks, 'person' => $person ]); } protected function getPersonParam(Request $request, EntityManagerInterface $em) { $person = $em->getRepository(Person::class) ->find($request->query->getInt('person_id')) ; if (NULL === $person) { throw $this->createNotFoundException('person not found'); } $this->denyAccessUnlessGranted(PersonVoter::SEE, $person, "You are " . "not allowed to see this person"); return $person; } protected function getUserParam(Request $request, EntityManagerInterface $em) { $user = $em->getRepository(User::class) ->find($request->query->getInt('user_id')) ; if (NULL === $user) { throw $this->createNotFoundException('user not found'); } return $user; } }