/**
  * DirectConversationEntity constructor.
  * @param array $participants
  */
 public function __construct(array $participants)
 {
     parent::__construct();
     $this->createdAt = new DateTime();
     $this->updatedAt = new DateTime();
     array_map(function (MessageUserInterface $u) {
         AbstractConversationEntity::addParticipant($this, $u);
     }, $participants);
 }
 /**
  * {@inheritdoc}
  */
 public function addParticipant(AbstractConversationEntity $conversation, MessageUserInterface $participant)
 {
     if ($conversation->getType() === DirectConversationEntity::TYPE) {
         throw IllegalOperationException::editingParticipantsOnDirectConversation();
     }
     AbstractConversationEntity::addParticipant($conversation, $participant);
     $eventArgs = ['conversation' => $conversation, 'participant' => $participant];
     $this->getEventManager()->trigger(new ConversationEvent(ConversationEvent::PARTICIPANT_ADDED, $this, $eventArgs));
     $this->objectManager->flush();
 }