PHP Class Sonata\ProductBundle\Controller\Api\ProductController

Author: Hugo Briand ([email protected])
Show file Open project: sonata-project/ecommerce

Protected Properties

Property Type Description
$formFactory Symfony\Component\Form\FormFactoryInterface
$formatterPool Sonata\FormatterBundle\Formatter\Pool
$productManager Sonata\Component\Product\ProductManagerInterface
$productPool Sonata\Component\Product\Pool

Public Methods

Method Description
__construct ( Sonata\Component\Product\ProductManagerInterface $productManager, Pool $productPool, Symfony\Component\Form\FormFactoryInterface $formFactory, Sonata\FormatterBundle\Formatter\Pool $formatterPool ) Constructor.
deleteProductAction ( integer $id ) : FOS\RestBundle\View\View Deletes a product.
getProductAction ( $id ) : Sonata\Component\Product\ProductInterface Retrieves a specific product.
getProductCategoriesAction ( $id ) : Sonata\ClassificationBundle\Model\CategoryInterface[] Retrieves a specific product's ProductCategories' categories.
getProductCollectionsAction ( $id ) : Sonata\ClassificationBundle\Model\CollectionInterface[] Retrieves a specific product's ProductCollections' collections.
getProductDeliveriesAction ( $id ) : Sonata\Component\Product\DeliveryInterface[] Retrieves a specific product's deliveries.
getProductPackagesAction ( $id ) : Sonata\Component\Product\PackageInterface[] Retrieves a specific product's packages.
getProductProductcategoriesAction ( $id ) : Sonata\Component\Product\ProductCategoryInterface[] Retrieves a specific product's ProductCategories.
getProductProductcollectionsAction ( $id ) : Sonata\Component\Product\ProductCollectionInterface[] Retrieves a specific product's ProductCollections.
getProductVariationsAction ( $id ) : Sonata\Component\Product\ProductInterface[] Retrieves a specific product's variations.
getProductsAction ( FOS\RestBundle\Request\ParamFetcherInterface $paramFetcher ) : Sonata\DatagridBundle\Pager\PagerInterface Returns a paginated list of products.
postProductAction ( string $provider, Request $request ) : Product Adds a product depending on the product provider.
putProductAction ( integer $id, string $provider, Request $request ) : Product Updates a product.

Protected Methods

Method Description
getProduct ( $id ) : Sonata\Component\Product\ProductInterface Retrieves product with id $id or throws an exception if it doesn't exist.
handleWriteProduct ( string $provider, Request $request, integer | null $id = null ) : FOS\RestBundle\View\View | FormInterface Write a product, this method is used by both POST and PUT action methods.

Method Details

__construct() public method

Constructor.
public __construct ( Sonata\Component\Product\ProductManagerInterface $productManager, Pool $productPool, Symfony\Component\Form\FormFactoryInterface $formFactory, Sonata\FormatterBundle\Formatter\Pool $formatterPool )
$productManager Sonata\Component\Product\ProductManagerInterface Sonata product manager
$productPool Sonata\Component\Product\Pool Sonata product pool
$formFactory Symfony\Component\Form\FormFactoryInterface Symfony form factory
$formatterPool Sonata\FormatterBundle\Formatter\Pool

deleteProductAction() public method

Deletes a product.
public deleteProductAction ( integer $id ) : FOS\RestBundle\View\View
$id integer A Product identifier
return FOS\RestBundle\View\View

getProduct() protected method

Retrieves product with id $id or throws an exception if it doesn't exist.
protected getProduct ( $id ) : Sonata\Component\Product\ProductInterface
$id
return Sonata\Component\Product\ProductInterface

getProductAction() public method

Retrieves a specific product.
public getProductAction ( $id ) : Sonata\Component\Product\ProductInterface
$id
return Sonata\Component\Product\ProductInterface

getProductCategoriesAction() public method

Retrieves a specific product's ProductCategories' categories.
public getProductCategoriesAction ( $id ) : Sonata\ClassificationBundle\Model\CategoryInterface[]
$id
return Sonata\ClassificationBundle\Model\CategoryInterface[]

getProductCollectionsAction() public method

Retrieves a specific product's ProductCollections' collections.
public getProductCollectionsAction ( $id ) : Sonata\ClassificationBundle\Model\CollectionInterface[]
$id
return Sonata\ClassificationBundle\Model\CollectionInterface[]

getProductDeliveriesAction() public method

Retrieves a specific product's deliveries.
public getProductDeliveriesAction ( $id ) : Sonata\Component\Product\DeliveryInterface[]
$id
return Sonata\Component\Product\DeliveryInterface[]

getProductPackagesAction() public method

Retrieves a specific product's packages.
public getProductPackagesAction ( $id ) : Sonata\Component\Product\PackageInterface[]
$id
return Sonata\Component\Product\PackageInterface[]

getProductProductcategoriesAction() public method

Retrieves a specific product's ProductCategories.
public getProductProductcategoriesAction ( $id ) : Sonata\Component\Product\ProductCategoryInterface[]
$id
return Sonata\Component\Product\ProductCategoryInterface[]

getProductProductcollectionsAction() public method

Retrieves a specific product's ProductCollections.
public getProductProductcollectionsAction ( $id ) : Sonata\Component\Product\ProductCollectionInterface[]
$id
return Sonata\Component\Product\ProductCollectionInterface[]

getProductVariationsAction() public method

Retrieves a specific product's variations.
public getProductVariationsAction ( $id ) : Sonata\Component\Product\ProductInterface[]
$id
return Sonata\Component\Product\ProductInterface[]

getProductsAction() public method

Returns a paginated list of products.
public getProductsAction ( FOS\RestBundle\Request\ParamFetcherInterface $paramFetcher ) : Sonata\DatagridBundle\Pager\PagerInterface
$paramFetcher FOS\RestBundle\Request\ParamFetcherInterface
return Sonata\DatagridBundle\Pager\PagerInterface

handleWriteProduct() protected method

Write a product, this method is used by both POST and PUT action methods.
protected handleWriteProduct ( string $provider, Request $request, integer | null $id = null ) : FOS\RestBundle\View\View | FormInterface
$provider string A product provider name
$request Symfony\Component\HttpFoundation\Request Symfony request
$id integer | null A product identifier
return FOS\RestBundle\View\View | FormInterface

postProductAction() public method

Adds a product depending on the product provider.
public postProductAction ( string $provider, Request $request ) : Product
$provider string A product provider name
$request Symfony\Component\HttpFoundation\Request A Symfony request
return Product

putProductAction() public method

Updates a product.
public putProductAction ( integer $id, string $provider, Request $request ) : Product
$id integer A Product identifier
$provider string A product provider name
$request Symfony\Component\HttpFoundation\Request A Symfony request
return Product

Property Details

$formFactory protected property

protected FormFactoryInterface,Symfony\Component\Form $formFactory
return Symfony\Component\Form\FormFactoryInterface

$formatterPool protected property

protected Pool,Sonata\FormatterBundle\Formatter $formatterPool
return Sonata\FormatterBundle\Formatter\Pool

$productManager protected property

protected ProductManagerInterface,Sonata\Component\Product $productManager
return Sonata\Component\Product\ProductManagerInterface

$productPool protected property

protected Pool,Sonata\Component\Product $productPool
return Sonata\Component\Product\Pool