/** * Find recursively all child categories of specified category * * @param Sppc_Category $category * @return array */ public function findChildRecursive(Sppc_Category $category) { $categories = array(); $where = array('id_category_parent = ?' => $category->getId()); $childs = $this->fetchAll($where); foreach ($childs as $children) { $childCategories = $this->findChildRecursive($children); $categories[] = $children; $categories += $childCategories; } return $categories; }
/** * Check if specified category exists in site categories * * @param Sppc_Category $category * @return bool */ public function hasCategory(Sppc_Category $category) { $categories = $this->getCategories(); return array_key_exists($category->getId(), $categories) ? true : false; }
/** * Return true if channel belongs to the specified category * * @param Sppc_Category $category * @return bool */ public function hasCategory(Sppc_Category $category) { $categories = $this->getCategories(); if (array_key_exists($category->getId(), $categories)) { return true; } return false; }