Esempio n. 1
0
 /**
  * Gets a thread by its ID
  * Performs authorization checks
  * Marks the thread as read
  *
  * @return ThreadInterface
  */
 public function getThread($threadId)
 {
     $thread = $this->threadManager->findThreadById($threadId);
     if (!$thread) {
         throw new NotFoundHttpException('There is no such thread');
     }
     if (!$this->authorizer->canSeeThread($thread)) {
         throw new AccessDeniedException('You are not allowed to see this thread');
     }
     // Load the thread messages before marking them as read
     // because we want to see the unread messages
     $thread->getMessages();
     $this->threadReader->markAsRead($thread);
     return $thread;
 }