Example #1
0
 /**
  *
  * @access protected
  * @param \Map2u\ForumBundle\Entity\Board $board
  */
 protected function updateBoardStats(Board $board)
 {
     if ($board) {
         if ($board->getId()) {
             $stats = $this->topicModel->getTopicAndPostCountForBoardById($board->getId());
             // set the board topic / post count
             $board->setCachedTopicCount($stats['topicCount']);
             $board->setCachedPostCount($stats['postCount']);
             $lastTopic = $this->topicModel->findLastTopicForBoardByIdWithLastPost($board->getId());
             // set last_post for board
             if ($lastTopic) {
                 $board->setLastPost($lastTopic->getLastPost() ?: null);
             } else {
                 $board->setLastPost(null);
             }
             $this->boardModel->updateBoard($board);
         }
     }
 }
 /**
  *
  * @access protected
  * @param \Map2u\ForumBundle\Entity\Board $board
  */
 protected function onSuccess(Board $board)
 {
     $this->dispatcher->dispatch(ForumEvents::ADMIN_BOARD_EDIT_SUCCESS, new AdminBoardEvent($this->request, $board));
     $this->boardModel->updateBoard($board);
     $this->dispatcher->dispatch(ForumEvents::ADMIN_BOARD_EDIT_COMPLETE, new AdminBoardEvent($this->request, $board));
 }