PHP Interface Sonata\Component\Product\ProductCategoryManagerInterface

Inheritance: extends Sonata\CoreBundle\Model\ManagerInterface
Exibir arquivo Open project: sonata-project/ecommerce Interface Usage Examples

Public Methods

Method Description
addCategoryToProduct ( Sonata\Component\Product\ProductInterface $product, Sonata\ClassificationBundle\Model\CategoryInterface $category, boolean $main = false ) Adds a Category to a Product.
getCategoryTree ( ) : Sonata\ClassificationBundle\Model\CategoryInterface[] Gets the category tree.
getProductCount ( Sonata\ClassificationBundle\Model\CategoryInterface $category, $limit = 1000 ) : integer Returns the number of products in $category (maxed by $limit).
removeCategoryFromProduct ( Sonata\Component\Product\ProductInterface $product, Sonata\ClassificationBundle\Model\CategoryInterface $category ) Removes a Category from a Product.

Method Details

addCategoryToProduct() public method

Adds a Category to a Product.
public addCategoryToProduct ( Sonata\Component\Product\ProductInterface $product, Sonata\ClassificationBundle\Model\CategoryInterface $category, boolean $main = false )
$product Sonata\Component\Product\ProductInterface A Product entity
$category Sonata\ClassificationBundle\Model\CategoryInterface A Category entity
$main boolean Add as the main category?

getCategoryTree() public method

Gets the category tree.
public getCategoryTree ( ) : Sonata\ClassificationBundle\Model\CategoryInterface[]
return Sonata\ClassificationBundle\Model\CategoryInterface[]

getProductCount() public method

Returns the number of products in $category (maxed by $limit).
public getProductCount ( Sonata\ClassificationBundle\Model\CategoryInterface $category, $limit = 1000 ) : integer
$category Sonata\ClassificationBundle\Model\CategoryInterface
return integer

removeCategoryFromProduct() public method

Removes a Category from a Product.
public removeCategoryFromProduct ( Sonata\Component\Product\ProductInterface $product, Sonata\ClassificationBundle\Model\CategoryInterface $category )
$product Sonata\Component\Product\ProductInterface
$category Sonata\ClassificationBundle\Model\CategoryInterface