示例#1
0
 /** @ORM\PostUpdate */
 public function postUpdate(Message $message, LifecycleEventArgs $event)
 {
     $entityManager = $event->getEntityManager();
     if ($message->getType() == 1) {
         $cacheDriver = $entityManager->getConfiguration()->getResultCacheImpl();
         $cacheDriver->delete('getUnreadPrestationMessages_' . $message->getReceiver()->getId() . '_' . $message->getPrestation()->getId());
         $cacheDriver->delete('getUnreadPrestationsMessages_' . $message->getReceiver()->getId());
     }
 }
示例#2
0
 /**
  * [messageNotification description]
  * @param  Message $message [description]
  * @return [type]           [description]
  */
 public function messageNotification(Message $message)
 {
     $to = $message->getReceiver()->getEmail();
     $template = 'MainCommonBundle:Emails\\Messages:prestation.html.twig';
     $subject = $this->translator->trans('prestation.message.subject', array(), 'email');
     $from = self::EMAIL;
     if ($to == $message->getPrestation()->getClient()->getEmail()) {
         $body = $this->templating->render($template, array('prestation' => $message->getPrestation(), 'user' => $message->getReceiver(), 'base_url' => $this->front, 'type' => 1));
     } else {
         $body = $this->templating->render($template, array('prestation' => $message->getPrestation(), 'user' => $message->getReceiver(), 'base_url' => $this->community, 'type' => 2));
     }
     $send = $this->canReceiveEmails($message->getReceiver(), 2);
     if ($send) {
         $this->sendMessage($from, $to, $subject, $body);
     }
 }