PHP Interface Sonata\Component\Basket\BasketElementInterface

Inheritance: extends Sonata\Component\Product\PriceComputableInterface
显示文件 Open project: sonata-project/ecommerce Interface Usage Examples

Public Methods

Method Description
getDelete ( ) : boolean
getName ( ) : string return the name of the basket element.
getOption ( string $name, mixed $default = null ) : mixed return a option value depends on the $name.
getOptions ( ) : array return the basket element options array.
getPosition ( ) : integer return the pos of the current basket element.
getProduct ( ) : Sonata\Component\Product\ProductInterface Return the related product.
getProductCode ( ) : string
getProductId ( ) : integer return the product id.
getProductManager ( ) : Sonata\Component\Product\ProductManagerInterface
getProductProvider ( ) : Sonata\Component\Product\ProductProviderInterface
getTotal ( boolean $vat = false ) : float Return the total (price * quantity).
getVatAmount ( ) Returns the VAT amount.
isPriceIncludingVat ( ) : boolean Returns if price is including VAT.
isValid ( ) : boolean Check if the basket element is still valid.
setDelete ( boolean $delete )
setOption ( string $name, mixed $value ) Define the option value.
setPosition ( integer $position ) the position in the basket stack.
setPriceIncludingVat ( float $priceIncludingVat ) Sets if current price is including VAT.
setProduct ( string $productCode, Sonata\Component\Product\ProductInterface $product ) Define the related product.
setProductDefinition ( ProductDefinition $productDefinition )
setProductId ( integer $productId ) Never call this method, use the setProduct instead. This method is only used by the form framework.
setUnitPrice ( float $unitPrice ) Sets product unit price.

Method Details

getDelete() public method

public getDelete ( ) : boolean
return boolean

getName() public method

return the name of the basket element.
public getName ( ) : string
return string

getOption() public method

return a option value depends on the $name.
public getOption ( string $name, mixed $default = null ) : mixed
$name string
$default mixed Default value if option not found
return mixed

getOptions() public method

return the basket element options array.
public getOptions ( ) : array
return array

getPosition() public method

return the pos of the current basket element.
public getPosition ( ) : integer
return integer

getProduct() public method

Return the related product.
public getProduct ( ) : Sonata\Component\Product\ProductInterface
return Sonata\Component\Product\ProductInterface

getProductCode() public method

public getProductCode ( ) : string
return string

getProductId() public method

return the product id.
public getProductId ( ) : integer
return integer

getProductManager() public method

public getProductManager ( ) : Sonata\Component\Product\ProductManagerInterface
return Sonata\Component\Product\ProductManagerInterface

getProductProvider() public method

public getProductProvider ( ) : Sonata\Component\Product\ProductProviderInterface
return Sonata\Component\Product\ProductProviderInterface

getTotal() public method

if $vat = true, return the price with vat
public getTotal ( boolean $vat = false ) : float
$vat boolean Returns price including VAT?
return float

getVatAmount() public method

Returns the VAT amount.
public getVatAmount ( )

isPriceIncludingVat() public method

Returns if price is including VAT.
public isPriceIncludingVat ( ) : boolean
return boolean

isValid() public method

Check if the basket element is still valid.
public isValid ( ) : boolean
return boolean

setDelete() public method

public setDelete ( boolean $delete )
$delete boolean

setOption() public method

Define the option value.
public setOption ( string $name, mixed $value )
$name string
$value mixed

setPosition() public method

the position in the basket stack.
public setPosition ( integer $position )
$position integer

setPriceIncludingVat() public method

Sets if current price is including VAT.
public setPriceIncludingVat ( float $priceIncludingVat )
$priceIncludingVat float

setProduct() public method

Define the related product.
public setProduct ( string $productCode, Sonata\Component\Product\ProductInterface $product )
$productCode string
$product Sonata\Component\Product\ProductInterface

setProductDefinition() public method

public setProductDefinition ( ProductDefinition $productDefinition )
$productDefinition Sonata\Component\Product\ProductDefinition

setProductId() public method

Never call this method, use the setProduct instead. This method is only used by the form framework.
public setProductId ( integer $productId )
$productId integer

setUnitPrice() public method

Sets product unit price.
public setUnitPrice ( float $unitPrice )
$unitPrice float