Пример #1
0
 /**
  * Add link
  *
  * @param \Main\SiteBundle\Entity\Link $link
  * @return User
  */
 public function addLink(\Main\SiteBundle\Entity\Link $link)
 {
     $this->link[] = $link;
     $link->setUser($this);
     return $this;
 }
Пример #2
0
 /**
  * @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'));
 }