/** * @Route("/admin/school/switch/{id}", name="school_switch", requirements={"id" = "\d+"}) * #ParamConverter("school", class="TSKSchoolBundle:School")# * @Method({"POST","GET"}) * @Template() */ public function switchAction(School $school) { $sessionKey = $this->container->getParameter('tsk_user.session.school_key'); $this->get('session')->set($sessionKey, $school->getId()); $this->get('session')->setFlash('notice', 'Your school has been switched'); return $this->redirect($this->generateUrl('sonata_admin_dashboard')); }