CoolCMS API

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
extends
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
#[ExternalReadonly]

$fees

protected Collection<int, OrderItemFee> $fees
Attributes
#[CollectionOf]
\App\UI\Admin\Eshop\Models\Entities\OrderItemFee::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\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]
#[ExternalReadonly]

$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\Admin\Eshop\Models\Entities\Order::class
$inversedBy: 'items'
$fetch: 'LAZY'
#[ParentRef]

$price

protected string $price = '0.000'
Attributes
#[Column]
$name: 'price'
$type: 'decimal'
$precision: 10
$scale: 3
#[ExternalReadonly]

$priceWithoutFees

protected string $priceWithoutFees = '0.000'
Attributes
#[Column]
$name: 'price_without_fees'
$type: 'decimal'
$precision: 10
$scale: 3
#[ExternalReadonly]

$priceWithVat

protected string $priceWithVat = '0.000'
Attributes
#[Column]
$name: 'price_with_vat'
$type: 'decimal'
$precision: 10
$scale: 3
#[ExternalReadonly]

$priceWithVatWithoutFees

protected string $priceWithVatWithoutFees = '0.000'
Attributes
#[Column]
$name: 'price_with_vat_without_fees'
$type: 'decimal'
$precision: 10
$scale: 3
#[ExternalReadonly]

$productSet

protected TProductSet|null $productSet = null

reference; the snapshot survives deleting the set (SET NULL)

Attributes
#[EntityOf]
\App\UI\Admin\Eshop\Models\Entities\ProductSet::class
#[JoinColumn]
$name: 'cms_mod_eshop_product_sets_product_set_id'
$referencedColumnName: 'product_set_id'
$nullable: true
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Admin\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]
#[ExternalReadonly]

$unit

protected string|null $unit = null
Attributes
#[Column]
$name: 'unit'
$type: 'string'
$length: 20
$nullable: true

$units

protected Collection<int, OrderItemUnit> $units
Attributes
#[CollectionOf]
\App\UI\Admin\Eshop\Models\Entities\OrderItemUnit::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\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
#[ExternalReadonly]

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
$this

addUnitEntity()

public addUnitEntity(TUnitEntity $unit) : $this
Parameters
$unit : TUnitEntity
Return values
$this

callInitMethods()

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|null

getDiscountPercents()

public getDiscountPercents() : string
Return values
string

getFees()

public getFees() : Collection<int, TFee>
Return values
Collection<int, TFee>

getName()

public getName() : string
Return values
string

getNotInStock()

public getNotInStock() : int
Return values
int

getOrder()

public getOrder() : TOrder|null
Return values
TOrder|null

getPrice()

public getPrice() : string
Return values
string

getPriceWithoutFees()

public getPriceWithoutFees() : string
Return values
string

getPriceWithVat()

public getPriceWithVat() : string
Return values
string

getPriceWithVatWithoutFees()

public getPriceWithVatWithoutFees() : string
Return values
string

getProductSet()

public getProductSet() : TProductSet|null
Return values
TProductSet|null

getQuantity()

public getQuantity() : int
Return values
int

getSupplyKindId()

public getSupplyKindId() : int|null
Return values
int|null

getUnit()

public getUnit() : string|null
Return values
string|null

getUnits()

public getUnits() : Collection<int, TUnitEntity>
Return values
Collection<int, TUnitEntity>

getVat()

public getVat() : string
Return values
string

getVatAsFloat()

public getVatAsFloat() : float
Return values
float

setCode()

public setCode(string|null $code) : $this
Parameters
$code : string|null
Return values
$this

setDiscountPercents()

public setDiscountPercents(string $discountPercents) : $this
Parameters
$discountPercents : string
Return values
$this

setFees()

public setFees(Collection<int, TFee>|array<int, TFee> $fees) : $this
Parameters
$fees : Collection<int, TFee>|array<int, TFee>
Return values
$this

setId()

public setId(int|null $id) : $this
Parameters
$id : int|null
Return values
$this

setName()

public setName(string $name) : $this
Parameters
$name : string
Return values
$this

setNotInStock()

public setNotInStock(int $notInStock) : $this
Parameters
$notInStock : int
Return values
$this

setOrder()

public setOrder(TOrder|null $order) : $this
Parameters
$order : TOrder|null
Return values
$this

setPrice()

public setPrice(string $price) : $this
Parameters
$price : string
Return values
$this

setPriceWithoutFees()

public setPriceWithoutFees(string $priceWithoutFees) : $this
Parameters
$priceWithoutFees : string
Return values
$this

setPriceWithVat()

public setPriceWithVat(string $priceWithVat) : $this
Parameters
$priceWithVat : string
Return values
$this

setPriceWithVatWithoutFees()

public setPriceWithVatWithoutFees(string $priceWithVatWithoutFees) : $this
Parameters
$priceWithVatWithoutFees : string
Return values
$this

setProductSet()

public setProductSet(TProductSet|null $productSet) : $this
Parameters
$productSet : TProductSet|null
Return values
$this

setQuantity()

public setQuantity(int $quantity) : $this
Parameters
$quantity : int
Return values
$this

setSupplyKindId()

public setSupplyKindId(int|null $supplyKindId) : $this
Parameters
$supplyKindId : int|null
Return values
$this

setUnit()

public setUnit(string|null $unit) : $this
Parameters
$unit : string|null
Return values
$this

setUnits()

public setUnits(Collection<int, TUnitEntity>|array<int, TUnitEntity> $units) : $this
Parameters
$units : Collection<int, TUnitEntity>|array<int, TUnitEntity>
Return values
$this

setVat()

public setVat(string $vat) : $this
Parameters
$vat : string
Return values
$this

getTraitsRecursive()

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>
Return values
array<string, string>
On this page

Search results