Пример #1
0
 /**
  * Removes all posts associated with category id
  * 
  * @param string $id Category's id
  * @return boolean
  */
 private function removeAllPostsById($id)
 {
     $webPageIds = $this->postMapper->fetchAllWebPageIdsByCategoryId($id);
     // Remove associated web pages, first
     foreach ($webPageIds as $webPageId) {
         $this->webPageManager->deleteById($webPageId);
     }
     // And then remove all posts
     $this->postMapper->deleteAllByCategoryId($id);
     return true;
 }
Пример #2
0
 /**
  * Count amount of posts in provided category id
  * 
  * @param string $categoryId
  * @return integer
  */
 public function getPostCountByCategoryId($categoryId)
 {
     return $this->postMapper->countAllByCategoryId($categoryId);
 }