示例#1
0
 /**
  * Gets a new category entity class.
  *
  * @param int           $id             The id to set to the entity.
  * @param bool          $isRoot         If the category is a root category.
  * @param Category|null $parentCategory The category to set as parent
  *
  * @return Category
  */
 public function getCategoryEntity($id, $isRoot, $parentCategory)
 {
     $category = new Category();
     $category->setId($id);
     $category->setRoot($isRoot);
     $category->setParent($parentCategory);
     return $category;
 }
示例#2
0
 /**
  * Checks if a category is enabled. A category can be disabled by itself or by other store configurations like
  * the options to only load categories with products.
  *
  * @param Category $category The category to check.
  *
  * @return bool If the category is enabled and should be showed on the categories tree.
  */
 protected function isCategoryEnabled(Category $category)
 {
     return $category->isEnabled() && (!$this->loadOnlyCategoriesWithProducts || 0 > $category->getProducts());
 }
 /**
  * Gets a new category
  *
  * @param integer $id It's id
  *
  * @return CategoryInterface
  */
 public function getNewCategory($id)
 {
     $category = new Category();
     $category->setId($id);
     return $category;
 }