PHP 클래스 Sonata\ProductBundle\Model\BaseProductProvider

상속: implements Sonata\Component\Product\ProductProviderInterface
파일 보기 프로젝트 열기: sonata-project/ecommerce 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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