OrderItem
extends OrderItem
in package
Order line: an immutable snapshot of a sellable product set at save time (name, code and unit from the catalog, prices from `PriceResolver`, rate from the VAT engine (`TaxManager`); built by `OrderSnapshotBuilder`). `productSet` is a reference only (`SET NULL`), so deleting the set does not invalidate the snapshot.
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_eshop_order_items'
- #[TableAlias]
- 'orderItem'
Table of Contents
Properties
- $code : string|null
- $discountPercents : string
- $fees : Collection<int, OrderItemFee>
- $id : int|null
- $name : string
- $notInStock : int
- $order : TOrder|null
- $price : string
- $priceWithoutFees : string
- $priceWithVat : string
- $priceWithVatWithoutFees : string
- $productSet : TProductSet|null
- $quantity : int
- $supplyKindId : int|null
- $unit : string|null
- $units : Collection<int, OrderItemUnit>
- $vat : string
Methods
- __construct() : mixed
- addFee() : $this
- addUnitEntity() : $this
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getCode() : string|null
- getDiscountPercents() : string
- getFees() : Collection<int, TFee>
- getId() : int|null
- getName() : string
- getNotInStock() : int
- getOrder() : TOrder|null
- getPrice() : string
- getPriceWithoutFees() : string
- getPriceWithVat() : string
- getPriceWithVatWithoutFees() : string
- getProductSet() : TProductSet|null
- getQuantity() : int
- getSupplyKindId() : int|null
- getUnit() : string|null
- getUnits() : Collection<int, TUnitEntity>
- getVat() : string
- getVatAsFloat() : float
- isPersisted() : bool
- setCode() : $this
- setDiscountPercents() : $this
- setFees() : $this
- setId() : $this
- setName() : $this
- setNotInStock() : $this
- setOrder() : $this
- setPrice() : $this
- setPriceWithoutFees() : $this
- setPriceWithVat() : $this
- setPriceWithVatWithoutFees() : $this
- setProductSet() : $this
- setQuantity() : $this
- setSupplyKindId() : $this
- setUnit() : $this
- setUnits() : $this
- setVat() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$code
protected
string|null
$code
= null
Attributes
- #[Column]
- $name: 'code'
- $type: 'string'
- $length: 45
- $nullable: true
$discountPercents
protected
string
$discountPercents
= '0.00'
Attributes
- #[Column]
- $name: 'discount_percents'
- $type: 'decimal'
- $precision: 5
- $scale: 2
$fees
protected
Collection<int, OrderItemFee>
$fees
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Eshop\Models\Entities\OrderItemFee::class
- $mappedBy: 'orderItem'
- $cascade: ['persist', 'remove']
- $orphanRemoval: true
- $fetch: 'LAZY'
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'order_item_id'
- $type: 'bigint'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$name
protected
string
$name
= ''
Attributes
- #[Column]
- $name: 'name'
- $type: 'string'
- $length: 255
$notInStock
protected
int
$notInStock
= 0
Attributes
- #[Column]
- $name: 'not_in_stock'
- $type: 'integer'
- $options: ['unsigned' => true]
$order
protected
TOrder|null
$order
= null
Attributes
- #[JoinColumn]
- $name: 'cms_mod_eshop_orders_order_id'
- $referencedColumnName: 'order_id'
- $nullable: false
- $onDelete: 'CASCADE'
- #[ManyToOne]
- $targetEntity: \App\UI\Api\Eshop\Models\Entities\Order::class
- $inversedBy: 'items'
- $fetch: 'LAZY'
$price
protected
string
$price
= '0.000'
Attributes
- #[Column]
- $name: 'price'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$priceWithoutFees
protected
string
$priceWithoutFees
= '0.000'
Attributes
- #[Column]
- $name: 'price_without_fees'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$priceWithVat
protected
string
$priceWithVat
= '0.000'
Attributes
- #[Column]
- $name: 'price_with_vat'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$priceWithVatWithoutFees
protected
string
$priceWithVatWithoutFees
= '0.000'
Attributes
- #[Column]
- $name: 'price_with_vat_without_fees'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$productSet
protected
TProductSet|null
$productSet
= null
reference; the snapshot survives deleting the set (SET NULL)
Attributes
- #[JoinColumn]
- $name: 'cms_mod_eshop_product_sets_product_set_id'
- $referencedColumnName: 'product_set_id'
- $nullable: true
- $onDelete: 'SET NULL'
- #[ManyToOne]
- $targetEntity: \App\UI\Api\Eshop\Models\Entities\ProductSet::class
- $fetch: 'LAZY'
$quantity
protected
int
$quantity
= 1
Attributes
- #[Column]
- $name: 'quantity'
- $type: 'integer'
- $options: ['unsigned' => true]
$supplyKindId
protected
int|null
$supplyKindId
= null
Attributes
- #[Column]
- $name: 'cms_system_supply_kinds_supply_kind_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$unit
protected
string|null
$unit
= null
Attributes
- #[Column]
- $name: 'unit'
- $type: 'string'
- $length: 20
- $nullable: true
$units
protected
Collection<int, OrderItemUnit>
$units
Attributes
- #[OneToMany]
- $targetEntity: \App\UI\Api\Eshop\Models\Entities\OrderItemUnit::class
- $mappedBy: 'orderItem'
- $cascade: ['persist', 'remove']
- $orphanRemoval: true
- $fetch: 'LAZY'
$vat
protected
string
$vat
= '0.00'
Attributes
- #[Column]
- $name: 'vat'
- $type: 'decimal'
- $precision: 5
- $scale: 2
Methods
__construct()
public
__construct([int|null $id = null ][, mixed $order = null ][, mixed $productSet = null ][, string $name = '' ][, string|null $code = null ][, int $quantity = 1 ][, string|null $unit = null ][, string $price = '0.000' ][, string $priceWithVat = '0.000' ][, string $priceWithoutFees = '0.000' ][, string $priceWithVatWithoutFees = '0.000' ][, string $vat = '0.00' ][, int|null $supplyKindId = null ][, string $discountPercents = '0.00' ][, int $notInStock = 0 ][, Collection $units = new ArrayCollection() ][, Collection $fees = new ArrayCollection() ]) : mixed
Parameters
- $id : int|null = null
- $order : mixed = null
- $productSet : mixed = null
- $name : string = ''
- $code : string|null = null
- $quantity : int = 1
- $unit : string|null = null
- $price : string = '0.000'
- $priceWithVat : string = '0.000'
- $priceWithoutFees : string = '0.000'
- $priceWithVatWithoutFees : string = '0.000'
- $vat : string = '0.00'
- $supplyKindId : int|null = null
- $discountPercents : string = '0.00'
- $notInStock : int = 0
- $units : Collection = new ArrayCollection()
- $fees : Collection = new ArrayCollection()
addFee()
public
addFee(TFee $fee) : $this
Parameters
- $fee : TFee
Return values
$thisaddUnitEntity()
public
addUnitEntity(TUnitEntity $unit) : $this
Parameters
- $unit : TUnitEntity
Return values
$thiscallInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getAllTraits()
Returns all traits the class uses, including those used by parent classes and nested traits.
public
getAllTraits() : array<string, string>
Return values
array<string, string>getCode()
public
getCode() : string|null
Return values
string|nullgetDiscountPercents()
public
getDiscountPercents() : string
Return values
stringgetFees()
public
getFees() : Collection<int, TFee>
Return values
Collection<int, TFee>getId()
public
getId() : int|null
Return values
int|nullgetName()
public
getName() : string
Return values
stringgetNotInStock()
public
getNotInStock() : int
Return values
intgetOrder()
public
getOrder() : TOrder|null
Return values
TOrder|nullgetPrice()
public
getPrice() : string
Return values
stringgetPriceWithoutFees()
public
getPriceWithoutFees() : string
Return values
stringgetPriceWithVat()
public
getPriceWithVat() : string
Return values
stringgetPriceWithVatWithoutFees()
public
getPriceWithVatWithoutFees() : string
Return values
stringgetProductSet()
public
getProductSet() : TProductSet|null
Return values
TProductSet|nullgetQuantity()
public
getQuantity() : int
Return values
intgetSupplyKindId()
public
getSupplyKindId() : int|null
Return values
int|nullgetUnit()
public
getUnit() : string|null
Return values
string|nullgetUnits()
public
getUnits() : Collection<int, TUnitEntity>
Return values
Collection<int, TUnitEntity>getVat()
public
getVat() : string
Return values
stringgetVatAsFloat()
public
getVatAsFloat() : float
Return values
floatisPersisted()
public
isPersisted() : bool
Return values
boolsetCode()
public
setCode(string|null $code) : $this
Parameters
- $code : string|null
Return values
$thissetDiscountPercents()
public
setDiscountPercents(string $discountPercents) : $this
Parameters
- $discountPercents : string
Return values
$thissetFees()
public
setFees(Collection<int, TFee>|array<int, TFee> $fees) : $this
Parameters
- $fees : Collection<int, TFee>|array<int, TFee>
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetName()
public
setName(string $name) : $this
Parameters
- $name : string
Return values
$thissetNotInStock()
public
setNotInStock(int $notInStock) : $this
Parameters
- $notInStock : int
Return values
$thissetOrder()
public
setOrder(TOrder|null $order) : $this
Parameters
- $order : TOrder|null
Return values
$thissetPrice()
public
setPrice(string $price) : $this
Parameters
- $price : string
Return values
$thissetPriceWithoutFees()
public
setPriceWithoutFees(string $priceWithoutFees) : $this
Parameters
- $priceWithoutFees : string
Return values
$thissetPriceWithVat()
public
setPriceWithVat(string $priceWithVat) : $this
Parameters
- $priceWithVat : string
Return values
$thissetPriceWithVatWithoutFees()
public
setPriceWithVatWithoutFees(string $priceWithVatWithoutFees) : $this
Parameters
- $priceWithVatWithoutFees : string
Return values
$thissetProductSet()
public
setProductSet(TProductSet|null $productSet) : $this
Parameters
- $productSet : TProductSet|null
Return values
$thissetQuantity()
public
setQuantity(int $quantity) : $this
Parameters
- $quantity : int
Return values
$thissetSupplyKindId()
public
setSupplyKindId(int|null $supplyKindId) : $this
Parameters
- $supplyKindId : int|null
Return values
$thissetUnit()
public
setUnit(string|null $unit) : $this
Parameters
- $unit : string|null
Return values
$thissetUnits()
public
setUnits(Collection<int, TUnitEntity>|array<int, TUnitEntity> $units) : $this
Parameters
- $units : Collection<int, TUnitEntity>|array<int, TUnitEntity>
Return values
$thissetVat()
public
setVat(string $vat) : $this
Parameters
- $vat : string
Return values
$thisgetTraitsRecursive()
Walks the trait list recursively and collects nested traits too.
private
static getTraitsRecursive(array<string, string> $traits) : array<string, string>
Parameters
- $traits : array<string, string>