protected function createBoard($category, $order, $name, $description, $cachedTopicCount, $cachedPostCount, array $boardReadRoles = array(), array $topicCreateRoles = array(), array $topicReplyRoles = array())
 {
     $board = new Board();
     $board->setCategory($category);
     $board->setName($name);
     $board->setDescription($description);
     $board->setCachedTopicCount($cachedTopicCount);
     $board->setCachedPostCount($cachedPostCount);
     $board->setListOrderPriority($order);
     $board->setReadAuthorisedRoles($boardReadRoles);
     $board->setTopicCreateAuthorisedRoles($topicCreateRoles);
     $board->setTopicReplyAuthorisedRoles($topicReplyRoles);
     return $board;
 }
 /**
  *
  * @access protected
  * @param \CCDNForum\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);
         }
     }
 }