EntityManager/ThreadManager.php
/**
     * Update the dates of last message written by other participants.
     * @param ThreadInterface $thread
     */
Update the dates of last message written by other participants.
Update the dates of last message written by other participants .
private function doDatesOfLastMessageWrittenByOtherParticipant(ThreadInterface $thread): void
    {
        foreach ($thread->getAllMetadata() as $i => $meta) {
            $participantId = $meta->getParticipant()->getId();
            $timestamp = 0;
            foreach ($thread->getMessages() as $message) {
                if ($participantId !== $message->getSender()->getId()) {
                    $timestamp = max($timestamp, $message->getTimestamp());
                }
            }
            if ($timestamp) {
                $date =  new DateTime();
                $date->setTimestamp($timestamp);
                $meta->setLastMessageDate($date);
            }
        }
    }
private function doDatesOfLastMessageWrittenByOtherParticipant ( ThreadInterface $ thread ) : void { foreach ( $ thread -> getAllMetadata ( ) as $ i => $ meta ) { $ participantId = $ meta -> getParticipant ( ) -> getId ( ) ; $ timestamp = 0 ; foreach ( $ thread -> getMessages ( ) as $ message ) { if ( $ participantId !== $ message -> getSender ( ) -> getId ( ) ) { $ timestamp = max ( $ timestamp , $ message -> getTimestamp ( ) ) ; } } if ( $ timestamp ) { $ date = new DateTime ( ) ; $ date -> setTimestamp ( $ timestamp ) ; $ meta -> setLastMessageDate ( $ date ) ; } } }
Update the dates of last message written by other participants.
Update the dates of last message written by other participants .