Exemplo n.º 1
0
 /**
  *
  * @access protected
  * @param \Map2u\ForumBundle\Entity\Topic $topic
  */
 protected function updateTopicStats(Topic $topic)
 {
     if ($topic->getId()) {
         // Get stats.
         $topicPostCount = $this->postModel->countPostsForTopicById($topic->getId());
         $topicFirstPost = $this->postModel->getFirstPostForTopicById($topic->getId());
         $topicLastPost = $this->postModel->getLastPostForTopicById($topic->getId());
         // Set the board / topic last post.
         $topic->setCachedReplyCount($topicPostCount > 0 ? --$topicPostCount : 0);
         $topic->setFirstPost($topicFirstPost ?: null);
         $topic->setLastPost($topicLastPost ?: null);
         $this->topicModel->updateTopic($topic);
     }
 }
 /**
  *
  * @access protected
  * @param \Map2u\ForumBundle\Entity\Topic $topic
  */
 protected function onSuccess(Topic $topic)
 {
     $this->dispatcher->dispatch(ForumEvents::MODERATOR_TOPIC_CHANGE_BOARD_SUCCESS, new ModeratorTopicEvent($this->request, $topic));
     $this->topicModel->updateTopic($topic);
     $this->dispatcher->dispatch(ForumEvents::MODERATOR_TOPIC_CHANGE_BOARD_COMPLETE, new ModeratorTopicMoveEvent($this->request, $this->oldBoard, $topic->getBoard(), $topic));
 }