PHP Class Sonata\ProductBundle\Entity\ProductManager

Inheritance: extends Sonata\CoreBundle\Model\BaseEntityManager, implements Sonata\Component\Product\ProductManagerInterface
Show file Open project: sonata-project/ecommerce

Public Methods

Method Description
findEnabledFromIdAndSlug ( integer $id, string $slug ) : Sonata\Component\Product\ProductInterface | null Retrieve an active product from its id and its slug.
findInSameCollections ( $productCollections, $limit = null )
findParentsInSameCollections ( $productCollections, $limit = null )
findProductForCategory ( Sonata\ClassificationBundle\Model\CategoryInterface $category ) : Sonata\Component\Product\ProductInterface | null Returns partial product example (only to get its class) from $category.
findVariations ( Sonata\Component\Product\ProductInterface $product )
getCategoryActiveProductsQueryBuilder ( Sonata\ClassificationBundle\Model\CategoryInterface $category = null, string $filter = null, mixed $option = null ) : Doctrine\ORM\QueryBuilder Returns active products for a given category.
getPager ( array $criteria, $page, $limit = 10, array $sort = [] )
updateStock ( $product, $diff )

Protected Methods

Method Description
getCategoryProductsQueryBuilder ( Sonata\ClassificationBundle\Model\CategoryInterface $category = null ) : Doctrine\ORM\QueryBuilder Returns QueryBuilder for products.
queryInSameCollections ( array $productCollections, null | integer $limit = null ) : Doctrine\ORM\QueryBuilder

Method Details

findEnabledFromIdAndSlug() public method

Retrieve an active product from its id and its slug.
public findEnabledFromIdAndSlug ( integer $id, string $slug ) : Sonata\Component\Product\ProductInterface | null
$id integer
$slug string
return Sonata\Component\Product\ProductInterface | null

findInSameCollections() public method

public findInSameCollections ( $productCollections, $limit = null )

findParentsInSameCollections() public method

public findParentsInSameCollections ( $productCollections, $limit = null )

findProductForCategory() public method

Returns partial product example (only to get its class) from $category.
public findProductForCategory ( Sonata\ClassificationBundle\Model\CategoryInterface $category ) : Sonata\Component\Product\ProductInterface | null
$category Sonata\ClassificationBundle\Model\CategoryInterface
return Sonata\Component\Product\ProductInterface | null

findVariations() public method

public findVariations ( Sonata\Component\Product\ProductInterface $product )
$product Sonata\Component\Product\ProductInterface

getCategoryActiveProductsQueryBuilder() public method

Returns active products for a given category.
public getCategoryActiveProductsQueryBuilder ( Sonata\ClassificationBundle\Model\CategoryInterface $category = null, string $filter = null, mixed $option = null ) : Doctrine\ORM\QueryBuilder
$category Sonata\ClassificationBundle\Model\CategoryInterface
$filter string
$option mixed
return Doctrine\ORM\QueryBuilder

getCategoryProductsQueryBuilder() protected method

Returns QueryBuilder for products.
protected getCategoryProductsQueryBuilder ( Sonata\ClassificationBundle\Model\CategoryInterface $category = null ) : Doctrine\ORM\QueryBuilder
$category Sonata\ClassificationBundle\Model\CategoryInterface
return Doctrine\ORM\QueryBuilder

getPager() public method

public getPager ( array $criteria, $page, $limit = 10, array $sort = [] )
$criteria array
$sort array

queryInSameCollections() protected method

protected queryInSameCollections ( array $productCollections, null | integer $limit = null ) : Doctrine\ORM\QueryBuilder
$productCollections array
$limit null | integer
return Doctrine\ORM\QueryBuilder

updateStock() public method

public updateStock ( $product, $diff )