public function membersList(ConversationInterface $conversation, PersonInterface $differentFrom = null) { $otherMembersUsernames = []; foreach ($conversation->getConversationPersons() as $conversationPerson) { if ($conversationPerson->getPerson()->getId() != $differentFrom->getId()) { $otherMembersUsernames[] = $conversationPerson->getPerson()->getUsername(); } } return implode(', ', $otherMembersUsernames); }
/** * {@inheritdoc} */ public function findConversationPerson(ConversationInterface $conversation, PersonInterface $person) { return $this->objectManager->createQueryBuilder()->select('cp', 'c', 'p', 't')->from($this->getConversationPersonClass(), 'cp')->innerJoin('cp.conversation', 'c')->innerJoin('cp.person', 'p')->leftJoin('cp.tags', 't')->where('c.id = :conversation')->setParameter('conversation', $conversation->getId())->andWhere('p.id = :person')->setParameter('person', $person->getId())->setMaxResults(1)->getQuery()->getOneOrNullResult(); }
/** * {@inheritdoc} */ public function isPersonInConversation(PersonInterface $person) { foreach ($this->persons as $conversationPerson) { if ($conversationPerson->getPerson()->getId() === $person->getId()) { return true; } } return false; }