EntityManager/MessageManager.php
/**
     * Marks all messages of this thread as read by this participant.
     *
     * @param ThreadInterface      $thread
     * @param ParticipantInterface $participant
     * @param bool                 $isRead
     *
     * @return void
     *
     * @throws Exception
     */
Marks all messages of this thread as read by this participant.

@return void

@throws Exception
Marks all messages of this thread as read by this participant . @return void @throws Exception
public function markIsReadByThreadAndParticipant(
        ThreadInterface $thread,
        ParticipantInterface $participant,
        bool $isRead
    ): void {
        $this->em->beginTransaction();
        try {
            $messages = $thread->getMessages();
            if (empty($messages) === false) {
                foreach ($messages as $message) {
                    $meta = $message->getMetadataForParticipant($participant);
                    if ($meta !== null) {
                        $meta->setIsRead($isRead);
                        $this->em->persist($meta);
                    }
                }
                $this->em->flush();
                $this->em->commit();
            }
        } catch (RuntimeException $e) {
            $this->em->rollback();
            throw $e;
        }
        $this->em->clear();
    }
public function markIsReadByThreadAndParticipant ( ThreadInterface $ thread , ParticipantInterface $ participant , bool $ isRead ) : void { $ this -> em -> beginTransaction ( ) ; try { $ messages = $ thread -> getMessages ( ) ; if ( empty ( $ messages ) === false ) { foreach ( $ messages as $ message ) { $ meta = $ message -> getMetadataForParticipant ( $ participant ) ; if ( $ meta !== null ) { $ meta -> setIsRead ( $ isRead ) ; $ this -> em -> persist ( $ meta ) ; } } $ this -> em -> flush ( ) ; $ this -> em -> commit ( ) ; } } catch ( RuntimeException $ e ) { $ this -> em -> rollback ( ) ; throw $ e ; } $ this -> em -> clear ( ) ; }
Marks all messages of this thread as read by this participant.
Marks all messages of this thread as read by this participant .