StockBatch
extends StockBatch
in package
Live `FIFO`/`FEFO` batch layers per item x warehouse x batch. Whole entity is server-managed (written by services via raw DBAL) — serves reads (batches grid, stock item tab).
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_store_stock_batches'
- #[TableAlias]
- 'stockBatch'
Table of Contents
Properties
- $batchNumber : string|null
- $expirationDate : DateTime|null
- $id : int|null
- $insertDatetime : DateTime
- $movementId : int|null
- $quantity : string
- $receivedDatetime : DateTime
- $stockItem : StockItem|null
- $stockItemId : int|null
- $unitPriceBase : string|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.
- getBatchNumber() : string|null
- getExpirationDate() : DateTime|null
- getId() : int|null
- getInsertDatetime() : DateTime
- getMovementId() : int|null
- getQuantity() : string
- getReceivedDatetime() : DateTime
- getStockItem() : StockItem|null
- getStockItemId() : int|null
- getUnitPriceBase() : string|null
- getUpdateDatetime() : DateTime|null
- getWarehouse() : Warehouse|null
- getWarehouseId() : int|null
- isPersisted() : bool
- setBatchNumber() : $this
- setExpirationDate() : $this
- setId() : $this
- setInsertDatetime() : $this
- setMovementId() : $this
- setQuantity() : $this
- setReceivedDatetime() : $this
- setStockItem() : self
- setStockItemId() : $this
- setUnitPriceBase() : $this
- setUpdateDatetime() : $this
- setWarehouse() : self
- setWarehouseId() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$batchNumber
protected
string|null
$batchNumber
= null
Attributes
- #[Column]
- $name: 'batch_number'
- $type: 'string'
- $length: 60
- $nullable: true
$expirationDate
protected
DateTime|null
$expirationDate
= null
Attributes
- #[Column]
- $name: 'expiration_date'
- $type: 'date'
- $nullable: true
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'stock_batch_id'
- $type: 'bigint'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$insertDatetime
protected
DateTime
$insertDatetime
= new DateTime()
Attributes
- #[Column]
- $name: 'insert_datetime'
- $type: 'datetime'
$movementId
protected
int|null
$movementId
= null
Attributes
- #[Column]
- $name: 'cms_mod_store_stock_movements_stock_movement_id'
- $type: 'bigint'
- $nullable: true
- $options: ['unsigned' => true]
$quantity
protected
string
$quantity
= '0.000'
Attributes
- #[Column]
- $name: 'quantity'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$receivedDatetime
protected
DateTime
$receivedDatetime
= new DateTime()
Attributes
- #[Column]
- $name: 'received_datetime'
- $type: 'datetime'
$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]
$unitPriceBase
protected
string|null
$unitPriceBase
= null
Attributes
- #[Column]
- $name: 'unit_price_base'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $nullable: 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|null $batchNumber = null ][, DateTime|null $expirationDate = null ][, string $quantity = '0.000' ][, string|null $unitPriceBase = null ][, DateTime $receivedDatetime = new DateTime() ][, int|null $movementId = null ][, DateTime $insertDatetime = new DateTime() ][, DateTime|null $updateDatetime = null ]) : mixed
Parameters
- $id : int|null = null
- $stockItemId : int|null = null
- $warehouseId : int|null = null
- $batchNumber : string|null = null
- $expirationDate : DateTime|null = null
- $quantity : string = '0.000'
- $unitPriceBase : string|null = null
- $receivedDatetime : DateTime = new DateTime()
- $movementId : int|null = null
- $insertDatetime : DateTime = new DateTime()
- $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>getBatchNumber()
public
getBatchNumber() : string|null
Return values
string|nullgetExpirationDate()
public
getExpirationDate() : DateTime|null
Return values
DateTime|nullgetId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetMovementId()
public
getMovementId() : int|null
Return values
int|nullgetQuantity()
public
getQuantity() : string
Return values
stringgetReceivedDatetime()
public
getReceivedDatetime() : DateTime
Return values
DateTimegetStockItem()
public
getStockItem() : StockItem|null
Return values
StockItem|nullgetStockItemId()
public
getStockItemId() : int|null
Return values
int|nullgetUnitPriceBase()
public
getUnitPriceBase() : string|null
Return values
string|nullgetUpdateDatetime()
public
getUpdateDatetime() : DateTime|null
Return values
DateTime|nullgetWarehouse()
public
getWarehouse() : Warehouse|null
Return values
Warehouse|nullgetWarehouseId()
public
getWarehouseId() : int|null
Return values
int|nullisPersisted()
public
isPersisted() : bool
Return values
boolsetBatchNumber()
public
setBatchNumber(string|null $batchNumber) : $this
Parameters
- $batchNumber : string|null
Return values
$thissetExpirationDate()
public
setExpirationDate(DateTime|null $expirationDate) : $this
Parameters
- $expirationDate : DateTime|null
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetInsertDatetime()
public
setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
- $insertDatetime : DateTime
Return values
$thissetMovementId()
public
setMovementId(int|null $movementId) : $this
Parameters
- $movementId : int|null
Return values
$thissetQuantity()
public
setQuantity(string $quantity) : $this
Parameters
- $quantity : string
Return values
$thissetReceivedDatetime()
public
setReceivedDatetime(DateTime $receivedDatetime) : $this
Parameters
- $receivedDatetime : DateTime
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
$thissetUnitPriceBase()
public
setUnitPriceBase(string|null $unitPriceBase) : $this
Parameters
- $unitPriceBase : string|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>