CoolCMS API

OrderItemUnit extends BaseEntity
in package

AbstractYes

Frozen breakdown of an order item into Store stock items: a snapshot of `SetCompositionService::decompose()` at save time (stockItemQuantities x line quantity).

PK = (orderItem, stockItemId): owned FK in the PK (#[ORM\Id] on the association) plus a scalar stockItemId without FK to Store (foreign module, like Invoice.order_id). The set composition can change any time, so release and confirm must read this snapshot, never the live set_item_relations. All Store calls go through this table, aggregated as a sum per stockItemId into one SourceRef(4,'order',$orderId).

An unmapped variant (without a stock item) has no row here; OrderItem::$notInStock carries it (full quantity).

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

Table of Contents

Properties

$orderItem  : TOrderItem|null
$quantity  : int
$stockItemId  : int|null

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.
getOrderItem()  : TOrderItem|null
getQuantity()  : int
getStockItemId()  : int|null
setOrderItem()  : $this
setQuantity()  : $this
setStockItemId()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$quantity

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

$stockItemId

protected int|null $stockItemId = null
Attributes
#[Column]
$name: 'stock_item_id'
$type: 'integer'
$options: ['unsigned' => true]
#[Id]
#[Identity]

Methods

__construct()

public __construct([mixed $orderItem = null ][, int|null $stockItemId = null ][, int $quantity = 0 ]) : mixed
Parameters
$orderItem : mixed = null
$stockItemId : int|null = null
$quantity : int = 0

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>

getOrderItem()

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

getStockItemId()

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

setOrderItem()

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

setQuantity()

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

setStockItemId()

public setStockItemId(int|null $stockItemId) : $this
Parameters
$stockItemId : int|null
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