code: public function getMessagesByThread(TopicInterface $thread, $limit = 25, $offset = 0)
      {
          $messages = $this->messageMapper->getMessagesByTopic($thread->getThreadId(), $limit, $offset);
          $messagesRet = array();
          foreach ($messages as $message) {
              $sender = $this->getServiceManager()->get("Zf2Forum_user_mapper")->findById($message->getUserId());
              /**
               * @return \Zd2Forum\Options\ModuleOptions
               */
              $options = $this->getServiceManager()->get('Zf2Forum\ModuleOptions');
              $funcName = "get" . $options->getUserColumn();
              $message->user = $sender->$funcName();
              $messagesRet[] = $message;
          }
  
          return $messagesRet;
      }
docs: getMessagesByThread
  
  @param ThreadInterface $thread
  @param int $limit
  @param int $offset
  @return array