示例#1
0
 /**
  * Sends the message by persisting it to the message manager and undeletes
  * the thread for all participants.
  *
  * @param MessageInterface $message
  */
 public function send(MessageInterface $message)
 {
     $this->threadManager->saveThread($message->getThread(), false);
     $this->messageManager->saveMessage($message, false);
     /* Note: Thread::setIsDeleted() depends on metadata existing for all
      * thread and message participants, so both objects must be saved first.
      * We can avoid flushing the object manager, since we must save once
      * again after undeleting the thread.
      */
     $message->getThread()->setIsDeleted(false);
     $this->messageManager->saveMessage($message);
     $this->dispatcher->dispatch(FOSMessageEvents::POST_SEND, new MessageEvent($message));
 }
示例#2
0
 /**
  * Starts composing a message in a reply to a thread
  *
  * @return ReplyMessageBuilder
  */
 public function reply(ThreadInterface $thread)
 {
     $message = $this->messageManager->createMessage();
     return new ReplyMessageBuilder($message, $thread);
 }
示例#3
0
 /**
  * Tells how many unread messages the authenticated participant has
  *
  * @return int the number of unread messages
  */
 public function getNbUnreadMessages()
 {
     return $this->messageManager->getNbUnreadMessageByParticipant($this->getAuthenticatedParticipant());
 }