/** * Marks the readable as unread by the current authenticated user * * @param ReadableInterface $readable */ public function markAsUnread(ReadableInterface $readable) { $participant = $this->getAuthenticatedParticipant(); if (!$readable->isReadByParticipant($participant)) { return; } $this->readableManager->markAsUnreadByParticipant($readable, $participant); $this->dispatcher->dispatch(FOSMessageEvents::POST_UNREAD, new ReadableEvent($readable)); }
/** * Tells if this readable (thread or message) is read by the current user * * @return boolean */ public function isRead(ReadableInterface $readable) { return $readable->isReadByParticipant($this->getAuthenticatedParticipant()); }
/** * Marks the readable as unread by this participant * * @param ReadableInterface $readable * @param ParticipantInterface $participant */ public function markAsUnreadByParticipant(ReadableInterface $readable, ParticipantInterface $participant) { $readable->setIsReadByParticipant($participant, false); }