コード例 #1
0
 /**
  * @return ConversationReceiverInterface
  */
 public function getConversationReceiverEntity()
 {
     if (empty($this->conversationReceiverEntity)) {
         $conversationReceiverClass = $this->options->getConversationReceiverEntity();
         $this->conversationReceiverEntity = new $conversationReceiverClass();
     }
     return $this->conversationReceiverEntity;
 }
コード例 #2
0
 /**
  * @param  ConversationInterface $conversation
  * @param  UserInterface         $user
  * @return bool
  */
 public function isUnread(ConversationInterface $conversation, UserInterface $user)
 {
     $this->getEventManager()->trigger('isUnread.pre', $this, ['conversation' => $conversation, 'user' => $user]);
     $repository = $this->objectManager->getRepository($this->options->getConversationReceiverEntity());
     $conversationReceiver = $repository->findOneBy(['conversation' => $conversation->getId(), 'to' => $user->getId()]);
     $unread = $conversationReceiver->getUnread();
     $this->getEventManager()->trigger('isUnread', $this, ['conversation' => $conversation, 'unread' => $unread]);
     return $unread;
 }