コード例 #1
0
ファイル: CategoryManager.php プロジェクト: bono-cms/Blog
 /**
  * Removes child albums that belong to provided id
  * 
  * @param string $parentId
  * @return boolean
  */
 private function removeChildCategoriesByParentId($parentId)
 {
     $treeBuilder = new TreeBuilder($this->categoryMapper->fetchAll());
     $ids = $treeBuilder->findChildNodeIds($parentId);
     // If there's at least one child id, then start working next
     if (!empty($ids)) {
         foreach ($ids as $id) {
             $this->removeAllById($id);
         }
     }
     return true;
 }
コード例 #2
0
 /**
  * Fetches all categories as a tree
  * 
  * @return array
  */
 public function fetchAllAsTree()
 {
     $treeBuilder = new TreeBuilder($this->categoryMapper->fetchAll());
     return $treeBuilder->render(new PhpArray('title'));
 }