/** * @Secure(roles="ROLE_USER") */ public function activeLinkAction(Link $lien) { switch ($lien->getActivate()) { case false: if ($lien->getAuthor() == $this->container->get('security.context')->getToken()->getUser()) { $lien->setActivate(true); $this->getDoctrine()->getEntityManager()->flush(); } break; case true: if ($lien->getAuthor() == $this->container->get('security.context')->getToken()->getUser()) { $lien->setActivate(false); $this->getDoctrine()->getEntityManager()->flush(); } break; default: if ($lien->getAuthor() == $this->container->get('security.context')->getToken()->getUser()) { $lien->setActivate(true); $this->getDoctrine()->getEntityManager()->flush(); } break; } return $this->redirect($this->get('request')->headers->get('referer')); }