PHP Класс Sonata\ProductBundle\Model\BaseProductProvider

Наследование: implements Sonata\Component\Product\ProductProviderInterface
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$basketElementManager Sonata\Component\Basket\BasketElementManagerInterface
$code string
$currencyPriceCalculator Sonata\Component\Currency\CurrencyPriceCalculatorInterface
$eventDispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$options array
$orderElementClassName string
$productCategoryManager Sonata\Component\Product\ProductCategoryManagerInterface
$productCollectionManager Sonata\Component\Product\ProductCollectionManagerInterface
$serializer JMS\Serializer\SerializerInterface
$variationFields array

Открытые методы

Метод Описание
__construct ( JMS\Serializer\SerializerInterface $serializer )
basketAddProduct ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, Sonata\Component\Basket\BasketElementInterface $basketElement ) : boolean | Sonata\Component\Basket\BasketElementInterface Adds $basketElement related to $product to $basket.
basketMergeProduct ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, Sonata\Component\Basket\BasketElementInterface $newBasketElement ) : boolean | Sonata\Component\Basket\BasketElementInterface Merge a product with another when the product is already present into the basket.
buildBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Product\ProductInterface $product = null, array $options = [] )
buildCreateForm ( Sonata\AdminBundle\Form\FormMapper $formMapper )
buildEditForm ( Sonata\AdminBundle\Form\FormMapper $formMapper, $isVariation = false )
buildForm ( Symfony\Component\Form\FormBuilderInterface $builder, array $options, $isVariation = false )
calculatePrice ( Sonata\Component\Product\ProductInterface $product, Sonata\Component\Currency\CurrencyInterface $currency, $vat = false, $quantity = 1 )
configureShowFields ( Sonata\AdminBundle\Show\ShowMapper $showMapper )
createBasketElement ( Sonata\Component\Product\ProductInterface $product = null, array $options = [] ) (non-PHPdoc).
createOrderElement ( Sonata\Component\Basket\BasketElementInterface $basketElement, string $format = 'json' ) : Sonata\Component\Order\OrderElementInterface
createVariation ( Sonata\Component\Product\ProductInterface $product, $copyDependencies = true )
defineAddBasketForm ( Sonata\Component\Product\ProductInterface $product, FormBuilder $formBuilder, boolean $showQuantity = true, array $options = [] ) This function return the form used in the product view page.
defineBasketElementForm ( Sonata\Component\Basket\BasketElementInterface $basketElement, FormBuilder $formBuilder, array $options = [] )
findOneById ( integer $id ) : boolean
getBasketElementManager ( ) : Sonata\Component\Basket\BasketElementManagerInterface
getCheapestEnabledVariation ( Sonata\Component\Product\ProductInterface $product )
getCode ( ) : string
getCurrencyPriceCalculator ( ) : Sonata\Component\Currency\CurrencyPriceCalculatorInterface
getEnabledVariations ( Sonata\Component\Product\ProductInterface $product )
getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
getFilters ( )
getOption ( string $name, mixed $default = null ) : array | null
getOptions ( ) : array
getProductCategoryManager ( )
getProductCollectionManager ( )
getProductFromRaw ( Sonata\Component\Order\OrderElementInterface $orderElement, string $type, string $format = 'json' ) : Sonata\Component\Product\ProductInterface
getRawProduct ( Sonata\Component\Product\ProductInterface $product, string $format = 'json' ) : array
getStockAvailable ( Sonata\Component\Product\ProductInterface $product )
getVariatedProperties ( Sonata\Component\Product\ProductInterface $product, array $fields = [] )
getVariation ( Sonata\Component\Product\ProductInterface $product, array $choices = [] )
getVariationFields ( ) : array
getVariationsChoices ( Sonata\Component\Product\ProductInterface $product, array $fields = [] )
hasEnabledVariations ( Sonata\Component\Product\ProductInterface $product )
hasVariationFields ( ) : boolean
hasVariations ( Sonata\Component\Product\ProductInterface $product )
isAddableToBasket ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, array $options = [] ) : boolean Return true if the product can be added to the provided basket.
isValidBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement ) : boolean
isVariateBy ( $name ) : boolean
reloadProduct ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Product\ProductInterface return a fresh product instance (so information are reloaded: enabled and stock .
setBasketElementManager ( Sonata\Component\Basket\BasketElementManagerInterface $basketElementManager )
setCode ( string $code )
setCurrencyPriceCalculator ( Sonata\Component\Currency\CurrencyPriceCalculatorInterface $currencyPriceCalculator )
setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher )
setOptions ( array $options = [] )
setOrderElementClassName ( string $orderElementClassName )
setProductCategoryManager ( Sonata\Component\Product\ProductCategoryManagerInterface $productCategoryManager )
setProductCollectionManager ( Sonata\Component\Product\ProductCollectionManagerInterface $productCollectionManager )
setVariationFields ( array $fields = [] )
synchronizeVariations ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
synchronizeVariationsCategories ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
synchronizeVariationsCollections ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
synchronizeVariationsDeliveries ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
synchronizeVariationsPackages ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
synchronizeVariationsProduct ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
updateComputationPricesFields ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Product\ProductInterface $product )
updateStock ( $product, Sonata\Component\Product\ProductManagerInterface $productManager, $diff )
validateFormBasketElement ( Sonata\CoreBundle\Validator\ErrorElement $errorElement, Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Basket\BasketInterface $basket )

Защищенные методы

Метод Описание
getMergedFields ( array $fields ) : array Checks $fields if specified, returns variation fields otherwise.

Описание методов

__construct() публичный метод

public __construct ( JMS\Serializer\SerializerInterface $serializer )
$serializer JMS\Serializer\SerializerInterface

basketAddProduct() публичный метод

Adds $basketElement related to $product to $basket.
public basketAddProduct ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, Sonata\Component\Basket\BasketElementInterface $basketElement ) : boolean | Sonata\Component\Basket\BasketElementInterface
$basket Sonata\Component\Basket\BasketInterface
$product Sonata\Component\Product\ProductInterface
$basketElement Sonata\Component\Basket\BasketElementInterface
Результат boolean | Sonata\Component\Basket\BasketElementInterface

basketMergeProduct() публичный метод

Merge a product with another when the product is already present into the basket.
public basketMergeProduct ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, Sonata\Component\Basket\BasketElementInterface $newBasketElement ) : boolean | Sonata\Component\Basket\BasketElementInterface
$basket Sonata\Component\Basket\BasketInterface
$product Sonata\Component\Product\ProductInterface
$newBasketElement Sonata\Component\Basket\BasketElementInterface
Результат boolean | Sonata\Component\Basket\BasketElementInterface

buildBasketElement() публичный метод

public buildBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Product\ProductInterface $product = null, array $options = [] )
$basketElement Sonata\Component\Basket\BasketElementInterface
$product Sonata\Component\Product\ProductInterface
$options array

buildCreateForm() публичный метод

public buildCreateForm ( Sonata\AdminBundle\Form\FormMapper $formMapper )
$formMapper Sonata\AdminBundle\Form\FormMapper

buildEditForm() публичный метод

public buildEditForm ( Sonata\AdminBundle\Form\FormMapper $formMapper, $isVariation = false )
$formMapper Sonata\AdminBundle\Form\FormMapper

buildForm() публичный метод

public buildForm ( Symfony\Component\Form\FormBuilderInterface $builder, array $options, $isVariation = false )
$builder Symfony\Component\Form\FormBuilderInterface
$options array

calculatePrice() публичный метод

public calculatePrice ( Sonata\Component\Product\ProductInterface $product, Sonata\Component\Currency\CurrencyInterface $currency, $vat = false, $quantity = 1 )
$product Sonata\Component\Product\ProductInterface
$currency Sonata\Component\Currency\CurrencyInterface

configureShowFields() публичный метод

public configureShowFields ( Sonata\AdminBundle\Show\ShowMapper $showMapper )
$showMapper Sonata\AdminBundle\Show\ShowMapper

createBasketElement() публичный метод

(non-PHPdoc).
См. также: Sonata\Component\Product\ProductProviderInterface::createBasketElement()
public createBasketElement ( Sonata\Component\Product\ProductInterface $product = null, array $options = [] )
$product Sonata\Component\Product\ProductInterface
$options array

createOrderElement() публичный метод

public createOrderElement ( Sonata\Component\Basket\BasketElementInterface $basketElement, string $format = 'json' ) : Sonata\Component\Order\OrderElementInterface
$basketElement Sonata\Component\Basket\BasketElementInterface A basket element instance
$format string A format to obtain raw product
Результат Sonata\Component\Order\OrderElementInterface

createVariation() публичный метод

public createVariation ( Sonata\Component\Product\ProductInterface $product, $copyDependencies = true )
$product Sonata\Component\Product\ProductInterface

defineAddBasketForm() публичный метод

This function return the form used in the product view page.
public defineAddBasketForm ( Sonata\Component\Product\ProductInterface $product, FormBuilder $formBuilder, boolean $showQuantity = true, array $options = [] )
$product Sonata\Component\Product\ProductInterface A Sonata product instance
$formBuilder Symfony\Component\Form\FormBuilder Symfony form builder
$showQuantity boolean Specifies if quantity field will be displayed (default true)
$options array An options array

defineBasketElementForm() публичный метод

public defineBasketElementForm ( Sonata\Component\Basket\BasketElementInterface $basketElement, FormBuilder $formBuilder, array $options = [] )
$basketElement Sonata\Component\Basket\BasketElementInterface
$formBuilder Symfony\Component\Form\FormBuilder
$options array

findOneById() публичный метод

public findOneById ( integer $id ) : boolean
$id integer
Результат boolean

getBasketElementManager() публичный метод

public getBasketElementManager ( ) : Sonata\Component\Basket\BasketElementManagerInterface
Результат Sonata\Component\Basket\BasketElementManagerInterface

getCheapestEnabledVariation() публичный метод

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

getCode() публичный метод

public getCode ( ) : string
Результат string

getCurrencyPriceCalculator() публичный метод

public getCurrencyPriceCalculator ( ) : Sonata\Component\Currency\CurrencyPriceCalculatorInterface
Результат Sonata\Component\Currency\CurrencyPriceCalculatorInterface

getEnabledVariations() публичный метод

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

getEventDispatcher() публичный метод

public getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
Результат Symfony\Component\EventDispatcher\EventDispatcherInterface

getFilters() публичный метод

public getFilters ( )

getMergedFields() защищенный метод

Checks $fields if specified, returns variation fields otherwise.
protected getMergedFields ( array $fields ) : array
$fields array
Результат array

getOption() публичный метод

public getOption ( string $name, mixed $default = null ) : array | null
$name string
$default mixed
Результат array | null

getOptions() публичный метод

public getOptions ( ) : array
Результат array

getProductCategoryManager() публичный метод

getProductCollectionManager() публичный метод

getProductFromRaw() публичный метод

public getProductFromRaw ( Sonata\Component\Order\OrderElementInterface $orderElement, string $type, string $format = 'json' ) : Sonata\Component\Product\ProductInterface
$orderElement Sonata\Component\Order\OrderElementInterface
$type string
$format string
Результат Sonata\Component\Product\ProductInterface

getRawProduct() публичный метод

public getRawProduct ( Sonata\Component\Product\ProductInterface $product, string $format = 'json' ) : array
$product Sonata\Component\Product\ProductInterface
$format string
Результат array

getStockAvailable() публичный метод

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

getVariatedProperties() публичный метод

public getVariatedProperties ( Sonata\Component\Product\ProductInterface $product, array $fields = [] )
$product Sonata\Component\Product\ProductInterface
$fields array

getVariation() публичный метод

public getVariation ( Sonata\Component\Product\ProductInterface $product, array $choices = [] )
$product Sonata\Component\Product\ProductInterface
$choices array

getVariationFields() публичный метод

public getVariationFields ( ) : array
Результат array

getVariationsChoices() публичный метод

public getVariationsChoices ( Sonata\Component\Product\ProductInterface $product, array $fields = [] )
$product Sonata\Component\Product\ProductInterface
$fields array

hasEnabledVariations() публичный метод

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

hasVariationFields() публичный метод

public hasVariationFields ( ) : boolean
Результат boolean return true if the product haas some variation fields

hasVariations() публичный метод

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

isAddableToBasket() публичный метод

Return true if the product can be added to the provided basket.
public isAddableToBasket ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Product\ProductInterface $product, array $options = [] ) : boolean
$basket Sonata\Component\Basket\BasketInterface
$product Sonata\Component\Product\ProductInterface
$options array
Результат boolean

isValidBasketElement() публичный метод

public isValidBasketElement ( Sonata\Component\Basket\BasketElementInterface $basketElement ) : boolean
$basketElement Sonata\Component\Basket\BasketElementInterface
Результат boolean true if the basket element is still valid

isVariateBy() публичный метод

public isVariateBy ( $name ) : boolean
$name
Результат boolean return true if the field $name is a variation

reloadProduct() публичный метод

..).
public reloadProduct ( Sonata\Component\Product\ProductInterface $product ) : Sonata\Component\Product\ProductInterface
$product Sonata\Component\Product\ProductInterface
Результат Sonata\Component\Product\ProductInterface

setBasketElementManager() публичный метод

public setBasketElementManager ( Sonata\Component\Basket\BasketElementManagerInterface $basketElementManager )
$basketElementManager Sonata\Component\Basket\BasketElementManagerInterface

setCode() публичный метод

public setCode ( string $code )
$code string

setCurrencyPriceCalculator() публичный метод

public setCurrencyPriceCalculator ( Sonata\Component\Currency\CurrencyPriceCalculatorInterface $currencyPriceCalculator )
$currencyPriceCalculator Sonata\Component\Currency\CurrencyPriceCalculatorInterface

setEventDispatcher() публичный метод

public setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher )
$eventDispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface

setOptions() публичный метод

public setOptions ( array $options = [] )
$options array

setOrderElementClassName() публичный метод

public setOrderElementClassName ( string $orderElementClassName )
$orderElementClassName string

setProductCategoryManager() публичный метод

public setProductCategoryManager ( Sonata\Component\Product\ProductCategoryManagerInterface $productCategoryManager )
$productCategoryManager Sonata\Component\Product\ProductCategoryManagerInterface

setProductCollectionManager() публичный метод

public setProductCollectionManager ( Sonata\Component\Product\ProductCollectionManagerInterface $productCollectionManager )
$productCollectionManager Sonata\Component\Product\ProductCollectionManagerInterface

setVariationFields() публичный метод

public setVariationFields ( array $fields = [] )
$fields array

synchronizeVariations() публичный метод

public synchronizeVariations ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
$product Sonata\Component\Product\ProductInterface
$variations Doctrine\Common\Collections\ArrayCollection

synchronizeVariationsCategories() публичный метод

public synchronizeVariationsCategories ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
$product Sonata\Component\Product\ProductInterface
$variations Doctrine\Common\Collections\ArrayCollection

synchronizeVariationsCollections() публичный метод

public synchronizeVariationsCollections ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
$product Sonata\Component\Product\ProductInterface
$variations Doctrine\Common\Collections\ArrayCollection

synchronizeVariationsDeliveries() публичный метод

public synchronizeVariationsDeliveries ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
$product Sonata\Component\Product\ProductInterface
$variations Doctrine\Common\Collections\ArrayCollection

synchronizeVariationsPackages() публичный метод

public synchronizeVariationsPackages ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
$product Sonata\Component\Product\ProductInterface
$variations Doctrine\Common\Collections\ArrayCollection

synchronizeVariationsProduct() публичный метод

public synchronizeVariationsProduct ( Sonata\Component\Product\ProductInterface $product, ArrayCollection $variations = null )
$product Sonata\Component\Product\ProductInterface
$variations Doctrine\Common\Collections\ArrayCollection

updateComputationPricesFields() публичный метод

public updateComputationPricesFields ( Sonata\Component\Basket\BasketInterface $basket, Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Product\ProductInterface $product )
$basket Sonata\Component\Basket\BasketInterface
$basketElement Sonata\Component\Basket\BasketElementInterface
$product Sonata\Component\Product\ProductInterface

updateStock() публичный метод

public updateStock ( $product, Sonata\Component\Product\ProductManagerInterface $productManager, $diff )
$productManager Sonata\Component\Product\ProductManagerInterface

validateFormBasketElement() публичный метод

public validateFormBasketElement ( Sonata\CoreBundle\Validator\ErrorElement $errorElement, Sonata\Component\Basket\BasketElementInterface $basketElement, Sonata\Component\Basket\BasketInterface $basket )
$errorElement Sonata\CoreBundle\Validator\ErrorElement
$basketElement Sonata\Component\Basket\BasketElementInterface
$basket Sonata\Component\Basket\BasketInterface

Описание свойств

$basketElementManager защищенное свойство

protected BasketElementManagerInterface,Sonata\Component\Basket $basketElementManager
Результат Sonata\Component\Basket\BasketElementManagerInterface

$code защищенное свойство

protected string $code
Результат string

$currencyPriceCalculator защищенное свойство

protected CurrencyPriceCalculatorInterface,Sonata\Component\Currency $currencyPriceCalculator
Результат Sonata\Component\Currency\CurrencyPriceCalculatorInterface

$eventDispatcher защищенное свойство

protected EventDispatcherInterface,Symfony\Component\EventDispatcher $eventDispatcher
Результат Symfony\Component\EventDispatcher\EventDispatcherInterface

$options защищенное свойство

protected array $options
Результат array

$orderElementClassName защищенное свойство

protected string $orderElementClassName
Результат string

$productCategoryManager защищенное свойство

protected ProductCategoryManagerInterface,Sonata\Component\Product $productCategoryManager
Результат Sonata\Component\Product\ProductCategoryManagerInterface

$productCollectionManager защищенное свойство

protected ProductCollectionManagerInterface,Sonata\Component\Product $productCollectionManager
Результат Sonata\Component\Product\ProductCollectionManagerInterface

$serializer защищенное свойство

protected SerializerInterface,JMS\Serializer $serializer
Результат JMS\Serializer\SerializerInterface

$variationFields защищенное свойство

protected array $variationFields
Результат array