/** * Lists all Dj entities. * * @Security("is_granted('ROLE_ADMIN')") * @Route("/admin", name="pa_logic_dj_admin") * @Method("GET") * @Template() */ public function adminIndexAction() { $em = $this->getDoctrine()->getManager(); $entities = $em->getRepository('PaLogicDjBundle:Dj')->findAll(); $updateStateForms = array(); $deleteForms = array(); foreach ($entities as $dj) { $updateStateForms[] = $this->createUpdateStateForm($dj)->createView(); $deleteForms[] = DjController::createDeleteForm($dj->getId(), $this->container)->createView(); } return array('entities' => $entities, 'update_state_forms' => $updateStateForms, 'delete_forms' => $deleteForms); }
/** * Show the user */ public function showAction() { $user = $this->container->get('security.context')->getToken()->getUser(); if (!is_object($user) || !$user instanceof UserInterface) { throw new AccessDeniedException('This user does not have access to this section.'); } $deleteForms = array(); foreach ($user->getDjs() as $dj) { $deleteForms[] = DjController::createDeleteForm($dj->getId(), $this->container)->createView(); } return $this->container->get('templating')->renderResponse('FOSUserBundle:Profile:show.html.' . $this->container->getParameter('fos_user.template.engine'), array('user' => $user, 'delete_forms' => $deleteForms)); }