Пример #1
0
 /**
  * "Notification vue, automatiquement updaté dans le backoffice"
  *
  * @ApiDoc(
  *  resource=true,
  *  description="Notification vue, automatiquement updaté dans le backoffice "
  * )
  *
  * @ParamConverter("notification", class="CoreUserBundle:Notification")
  * @Rest\Put("/notifications/{uid}")
  *
  * @param Notification $notification
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function putAction(Notification $notification)
 {
     $notification->setSeen(true);
     $this->getResourceManager()->fireEvent(CoreRestEvents::RESOURCE_CHECK_UPDATE, $notification);
     $this->getResourceManager()->update($notification);
     return $this->handleView($this->view($notification));
 }
Пример #2
0
 public function sendAllGroup($pro, $event, $text)
 {
     $rep = $this->rm->getRepository(new User());
     //Recupérer les utilisateurs de pro en fonction de l'id du groupe
     $users = $rep->findAll();
     foreach ($users as $user) {
         if ($user->getProfessional() == $pro) {
             $notif = new Notification();
             $notif->setUser($user);
             $notif->setText($text);
             $notif->setType($event->getName());
             $notif->setDatas(array($event->getResource()));
             $this->rm->create($notif);
         }
     }
 }