CoolCMS API

OrderItemFee extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait

AbstractYes

Snapshot of an order item fee (name, unit price and rate at save time; `fee` is a reference only, `SET NULL`). Fees enter `total_price`: they are already included in `OrderItem::$price`/`$priceWithVat`, and this row is the breakdown for the admin detail and for the flat InvoiceItem row ("{fee} - {item}").

Prices are per unit; price is the primary snapshot (the FeePrice price list is the base without VAT), priceWithVat is computed through the rate vat.

Tags
template
Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'orderItemFee'

Table of Contents

Interfaces

IdentifiableInterface
Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).

Properties

$fee  : TFee|null
$id  : int|null
$name  : string
$orderItem  : TOrderItem|null
$price  : string
$priceWithVat  : string
$quantity  : int
$vat  : string

Methods

__construct()  : mixed
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.
getFee()  : TFee|null
getId()  : int|null
getName()  : string
getOrderItem()  : TOrderItem|null
getPrice()  : string
getPriceWithVat()  : string
getQuantity()  : int
getVat()  : string
getVatAsFloat()  : float
isPersisted()  : bool
setFee()  : $this
setId()  : $this
setName()  : $this
setOrderItem()  : $this
setPrice()  : $this
setPriceWithVat()  : $this
setQuantity()  : $this
setVat()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$fee

protected TFee|null $fee = null

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

$id

protected int|null $id = null
Attributes
#[Column]
$name: 'order_item_fee_id'
$type: 'bigint'
$options: ['unsigned' => true]
#[GeneratedValue]
#[Id]

$name

protected string $name = ''
Attributes
#[Column]
$name: 'name'
$type: 'string'
$length: 255

$price

protected string $price = '0.000'
Attributes
#[Column]
$name: 'price'
$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]

$quantity

protected int $quantity = 1
Attributes
#[Column]
$name: 'quantity'
$type: 'integer'
$options: ['unsigned' => true]

Methods

__construct()

public __construct([int|null $id = null ][, mixed $orderItem = null ][, mixed $fee = null ][, string $name = '' ][, string $price = '0.000' ][, string $priceWithVat = '0.000' ][, string $vat = '0.00' ][, int $quantity = 1 ]) : mixed
Parameters
$id : int|null = null
$orderItem : mixed = null
$fee : mixed = null
$name : string = ''
$price : string = '0.000'
$priceWithVat : string = '0.000'
$vat : string = '0.00'
$quantity : int = 1

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>

getFee()

public getFee() : TFee|null
Return values
TFee|null

getName()

public getName() : string
Return values
string

getOrderItem()

public getOrderItem() : TOrderItem|null
Return values
TOrderItem|null

getPrice()

public getPrice() : string
Return values
string

getPriceWithVat()

public getPriceWithVat() : string
Return values
string

getQuantity()

public getQuantity() : int
Return values
int

getVatAsFloat()

public getVatAsFloat() : float
Return values
float

setFee()

public setFee(TFee|null $fee) : $this
Parameters
$fee : TFee|null
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

setOrderItem()

public setOrderItem(TOrderItem|null $orderItem) : $this
Parameters
$orderItem : TOrderItem|null
Return values
$this

setPrice()

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

setPriceWithVat()

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

setQuantity()

public setQuantity(int $quantity) : $this
Parameters
$quantity : int
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