/** * @desc Category[string] the childrens Categories map (id => category) for category id * @param int $id_category * @param SearchCategoryChildrensOptions $search_category_children_options */ public function get_childrens($id_category, SearchCategoryChildrensOptions $search_category_children_options, $add_this = false) { if (!$this->get_categories_cache()->category_exists($id_category)) { throw new CategoryNotFoundException($id_category); } $categories = $this->categories_cache->get_categories(); $root_category = $categories[Category::ROOT_CATEGORY]; $childrens_categories = array(); if ($add_this) { $childrens_categories[$id_category] = $this->categories_cache->get_category($id_category); } if ($search_category_children_options->is_excluded_categories_recursive() && $search_category_children_options->category_is_excluded($root_category) || !$search_category_children_options->check_authorizations($root_category)) { return array(); } if ($id_category == Category::ROOT_CATEGORY && !$search_category_children_options->category_is_excluded($root_category)) { $childrens_categories[Category::ROOT_CATEGORY] = $root_category; } return $this->build_children_map($id_category, $categories, $id_category, $search_category_children_options, $childrens_categories); }