StockLevel
extends StockLevel
in package
Denormalized stock levels per item x warehouse. Written exclusively by services in the same transaction as the movement journal — the entity serves reads (grids, availability).
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_store_stock_levels'
- #[TableAlias]
- 'stockLevel'
Table of Contents
Properties
- $id : int|null
- $lowStock : bool
- $quantity : string
- $reserved : string
- $stockItem : StockItem|null
- $stockItemId : int|null
- $updateDatetime : DateTime|null
- $warehouse : Warehouse|null
- $warehouseId : 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.
- getAvailable() : string
- Returns the available quantity: `quantity` minus `reserved` (bcmath, scale 3).
- getId() : int|null
- getQuantity() : string
- getReserved() : string
- getStockItem() : StockItem|null
- getStockItemId() : int|null
- getUpdateDatetime() : DateTime|null
- getWarehouse() : Warehouse|null
- getWarehouseId() : int|null
- isLowStock() : bool
- isPersisted() : bool
- setId() : $this
- setLowStock() : self
- setQuantity() : $this
- setReserved() : $this
- setStockItem() : self
- setStockItemId() : $this
- setUpdateDatetime() : $this
- setWarehouse() : self
- setWarehouseId() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
- n() : numeric-string
Properties
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'stock_level_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$lowStock
protected
bool
$lowStock
= false
Attributes
- #[Transient]
$quantity
protected
string
$quantity
= '0.000'
Attributes
- #[Column]
- $name: 'quantity'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$reserved
protected
string
$reserved
= '0.000'
Attributes
- #[Column]
- $name: 'reserved'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$stockItem
protected
StockItem|null
$stockItem
= null
Attributes
- #[EntityOf]
- \App\UI\Admin\Store\Models\Entities\StockItem::class
- #[JoinColumn]
- $name: 'cms_mod_store_stock_items_stock_item_id'
- $referencedColumnName: 'stock_item_id'
- $onDelete: 'CASCADE'
- #[ManyToOne]
- $targetEntity: \App\UI\Admin\Store\Models\Entities\StockItem::class
$stockItemId
protected
int|null
$stockItemId
= null
Attributes
- #[Column]
- $name: 'cms_mod_store_stock_items_stock_item_id'
- $type: 'integer'
- $insertable: false
- $updatable: false
- $nullable: true
- $options: ['unsigned' => true]
$updateDatetime
protected
DateTime|null
$updateDatetime
= null
Attributes
- #[Column]
- $name: 'update_datetime'
- $type: 'datetime'
- $nullable: true
$warehouse
protected
Warehouse|null
$warehouse
= null
Attributes
- #[EntityOf]
- \App\UI\Admin\Store\Models\Entities\Warehouse::class
- #[JoinColumn]
- $name: 'cms_mod_store_warehouses_warehouse_id'
- $referencedColumnName: 'warehouse_id'
- $onDelete: 'CASCADE'
- #[ManyToOne]
- $targetEntity: \App\UI\Admin\Store\Models\Entities\Warehouse::class
$warehouseId
protected
int|null
$warehouseId
= null
Attributes
- #[Column]
- $name: 'cms_mod_store_warehouses_warehouse_id'
- $type: 'integer'
- $insertable: false
- $updatable: false
- $nullable: true
- $options: ['unsigned' => true]
Methods
__construct()
public
__construct([int|null $id = null ][, int|null $stockItemId = null ][, int|null $warehouseId = null ][, string $quantity = '0.000' ][, string $reserved = '0.000' ][, DateTime|null $updateDatetime = null ]) : mixed
Parameters
- $id : int|null = null
- $stockItemId : int|null = null
- $warehouseId : int|null = null
- $quantity : string = '0.000'
- $reserved : string = '0.000'
- $updateDatetime : DateTime|null = null
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>getAvailable()
Returns the available quantity: `quantity` minus `reserved` (bcmath, scale 3).
public
getAvailable() : string
Return values
stringgetId()
public
getId() : int|null
Return values
int|nullgetQuantity()
public
getQuantity() : string
Return values
stringgetReserved()
public
getReserved() : string
Return values
stringgetStockItem()
public
getStockItem() : StockItem|null
Return values
StockItem|nullgetStockItemId()
public
getStockItemId() : int|null
Return values
int|nullgetUpdateDatetime()
public
getUpdateDatetime() : DateTime|null
Return values
DateTime|nullgetWarehouse()
public
getWarehouse() : Warehouse|null
Return values
Warehouse|nullgetWarehouseId()
public
getWarehouseId() : int|null
Return values
int|nullisLowStock()
public
isLowStock() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolsetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetLowStock()
public
setLowStock(bool $lowStock) : self
Parameters
- $lowStock : bool
Return values
selfsetQuantity()
public
setQuantity(string $quantity) : $this
Parameters
- $quantity : string
Return values
$thissetReserved()
public
setReserved(string $reserved) : $this
Parameters
- $reserved : string
Return values
$thissetStockItem()
public
setStockItem(StockItem|null $stockItem) : self
Parameters
- $stockItem : StockItem|null
Return values
selfsetStockItemId()
public
setStockItemId(int|null $stockItemId) : $this
Parameters
- $stockItemId : int|null
Return values
$thissetUpdateDatetime()
public
setUpdateDatetime(DateTime|null $updateDatetime) : $this
Parameters
- $updateDatetime : DateTime|null
Return values
$thissetWarehouse()
public
setWarehouse(Warehouse|null $warehouse) : self
Parameters
- $warehouse : Warehouse|null
Return values
selfsetWarehouseId()
public
setWarehouseId(int|null $warehouseId) : $this
Parameters
- $warehouseId : int|null
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>
Return values
array<string, string>n()
private
n(string $value) : numeric-string
Parameters
- $value : string
Return values
numeric-string —bcmath wrapper (normalizes a plain string)