CoolCMS API

StockDocument extends StockDocument
in package

Stock document header (receipt/issue/transfer/inventory). Draft is a plain CRUD object-graph (movements owned collection). Posting = explicit DocumentService::post(), not a save hook. Posted document is immutable.

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_mod_store_stock_documents'
#[TableAlias]
'stockDocument'

Table of Contents

Properties

$id  : int|null
$insertDatetime  : DateTime
$movements  : Collection
$note  : string|null
$number  : string|null
$postedDatetime  : DateTime|null
$sourceId  : int|null
$sourceModule  : int|null
$sourceType  : string|null
$status  : int
$stornoDocumentId  : int|null
$supplier  : Supplier|null
$supplierId  : int|null
$targetWarehouse  : Warehouse|null
$targetWarehouseId  : int|null
$type  : int
$userId  : int|null
$warehouse  : Warehouse|null
$warehouseId  : int|null

Methods

__construct()  : mixed
addMovement()  : $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.
getId()  : int|null
getInsertDatetime()  : DateTime
getMovement()  : TMovement|null
getMovements()  : Collection<int, TMovement>
getNote()  : string|null
getNumber()  : string|null
getPostedDatetime()  : DateTime|null
getSourceId()  : int|null
getSourceModule()  : int|null
getSourceType()  : string|null
getStatus()  : int
getStornoDocumentId()  : int|null
getSupplier()  : Supplier|null
getSupplierId()  : int|null
getTargetWarehouse()  : Warehouse|null
getTargetWarehouseId()  : int|null
getType()  : int
getUserId()  : int|null
getWarehouse()  : Warehouse|null
getWarehouseId()  : int|null
isPersisted()  : bool
movementCollectionInit()  : void
removeMovement()  : $this
setId()  : $this
setInsertDatetime()  : $this
setMovements()  : $this
setNote()  : $this
setNumber()  : $this
setPostedDatetime()  : $this
setSourceId()  : $this
setSourceModule()  : $this
setSourceType()  : $this
setStatus()  : $this
setStornoDocumentId()  : $this
setSupplier()  : self
setSupplierId()  : $this
setTargetWarehouse()  : self
setTargetWarehouseId()  : $this
setType()  : $this
setUserId()  : $this
setWarehouse()  : self
setWarehouseId()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$id

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

$insertDatetime

protected DateTime $insertDatetime = new DateTime()
Attributes
#[Column]
$name: 'insert_datetime'
$type: 'datetime'
#[ExternalReadonly]

$movements

protected Collection $movements
Attributes
#[OneToMany]
$targetEntity: \App\UI\Api\Store\Models\Entities\StockMovement::class
$mappedBy: 'document'
$cascade: ['persist', 'remove']
$orphanRemoval: true

$note

protected string|null $note = null
Attributes
#[Column]
$name: 'note'
$type: 'text'
$nullable: true

$number

protected string|null $number = null
Attributes
#[Column]
$name: 'number'
$type: 'string'
$length: 30
$nullable: true
#[ExternalReadonly]

$postedDatetime

protected DateTime|null $postedDatetime = null
Attributes
#[Column]
$name: 'posted_datetime'
$type: 'datetime'
$nullable: true
#[ExternalReadonly]

$sourceId

protected int|null $sourceId = null
Attributes
#[Column]
$name: 'source_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$sourceModule

protected int|null $sourceModule = null
Attributes
#[Column]
$name: 'source_module'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$sourceType

protected string|null $sourceType = null
Attributes
#[Column]
$name: 'source_type'
$type: 'string'
$length: 30
$nullable: true

$status

protected int $status = StockDocumentStatus::DRAFT
Attributes
#[Column]
$name: 'status'
$type: 'integer'
$options: ['unsigned' => true]
#[ExternalReadonly]

$stornoDocumentId

protected int|null $stornoDocumentId = null
Attributes
#[Column]
$name: 'storno_document_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]
#[ExternalReadonly]

$supplier

protected Supplier|null $supplier = null
Attributes
#[JoinColumn]
$name: 'cms_mod_store_suppliers_supplier_id'
$referencedColumnName: 'supplier_id'
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Api\Store\Models\Entities\Supplier::class

$supplierId

protected int|null $supplierId = null
Attributes
#[Column]
$name: 'cms_mod_store_suppliers_supplier_id'
$type: 'integer'
$insertable: false
$updatable: false
$nullable: true
$options: ['unsigned' => true]

$targetWarehouse

protected Warehouse|null $targetWarehouse = null
Attributes
#[JoinColumn]
$name: 'cms_mod_store_warehouses_warehouse_id2'
$referencedColumnName: 'warehouse_id'
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Api\Store\Models\Entities\Warehouse::class

$targetWarehouseId

protected int|null $targetWarehouseId = null
Attributes
#[Column]
$name: 'cms_mod_store_warehouses_warehouse_id2'
$type: 'integer'
$insertable: false
$updatable: false
$nullable: true
$options: ['unsigned' => true]

$type

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

$userId

protected int|null $userId = null
Attributes
#[Column]
$name: 'cms_system_users_user_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]
#[ExternalReadonly]

$warehouse

protected Warehouse|null $warehouse = null
Attributes
#[JoinColumn]
$name: 'cms_mod_store_warehouses_warehouse_id'
$referencedColumnName: 'warehouse_id'
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Api\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 $type = StockDocumentType::RECEIPT ][, int $status = StockDocumentStatus::DRAFT ][, string|null $number = null ][, int|null $warehouseId = null ][, int|null $targetWarehouseId = null ][, int|null $supplierId = null ][, int|null $sourceModule = null ][, string|null $sourceType = null ][, int|null $sourceId = null ][, int|null $stornoDocumentId = null ][, string|null $note = null ][, int|null $userId = null ][, DateTime|null $postedDatetime = null ][, DateTime $insertDatetime = new DateTime() ][, Collection $movements = new ArrayCollection() ]) : mixed
Parameters
$id : int|null = null
$type : int = StockDocumentType::RECEIPT
$status : int = StockDocumentStatus::DRAFT
$number : string|null = null
$warehouseId : int|null = null
$targetWarehouseId : int|null = null
$supplierId : int|null = null
$sourceModule : int|null = null
$sourceType : string|null = null
$sourceId : int|null = null
$stornoDocumentId : int|null = null
$note : string|null = null
$userId : int|null = null
$postedDatetime : DateTime|null = null
$insertDatetime : DateTime = new DateTime()
$movements : Collection = new ArrayCollection()

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>

getInsertDatetime()

public getInsertDatetime() : DateTime
Return values
DateTime

getMovement()

public getMovement(int $movementId) : TMovement|null
Parameters
$movementId : int
Return values
TMovement|null

getNote()

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

getNumber()

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

getPostedDatetime()

public getPostedDatetime() : DateTime|null
Return values
DateTime|null

getSourceId()

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

getSourceModule()

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

getSourceType()

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

getStornoDocumentId()

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

getSupplierId()

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

getTargetWarehouseId()

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

getUserId()

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

getWarehouseId()

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

removeMovement()

public removeMovement(TMovement $movement) : $this
Parameters
$movement : TMovement
Return values
$this

setId()

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

setInsertDatetime()

public setInsertDatetime(DateTime $insertDatetime) : $this
Parameters
$insertDatetime : DateTime
Return values
$this

setMovements()

public setMovements(Collection<int, TMovement>|array<int, TMovement> $movements) : $this
Parameters
$movements : Collection<int, TMovement>|array<int, TMovement>
Return values
$this

setNote()

public setNote(string|null $note) : $this
Parameters
$note : string|null
Return values
$this

setNumber()

public setNumber(string|null $number) : $this
Parameters
$number : string|null
Return values
$this

setPostedDatetime()

public setPostedDatetime(DateTime|null $postedDatetime) : $this
Parameters
$postedDatetime : DateTime|null
Return values
$this

setSourceId()

public setSourceId(int|null $sourceId) : $this
Parameters
$sourceId : int|null
Return values
$this

setSourceModule()

public setSourceModule(int|null $sourceModule) : $this
Parameters
$sourceModule : int|null
Return values
$this

setSourceType()

public setSourceType(string|null $sourceType) : $this
Parameters
$sourceType : string|null
Return values
$this

setStatus()

public setStatus(int $status) : $this
Parameters
$status : int
Return values
$this

setStornoDocumentId()

public setStornoDocumentId(int|null $stornoDocumentId) : $this
Parameters
$stornoDocumentId : int|null
Return values
$this

setSupplierId()

public setSupplierId(int|null $supplierId) : $this
Parameters
$supplierId : int|null
Return values
$this

setTargetWarehouse()

public setTargetWarehouse(Warehouse|null $targetWarehouse) : self
Parameters
$targetWarehouse : Warehouse|null
Return values
self

setTargetWarehouseId()

public setTargetWarehouseId(int|null $targetWarehouseId) : $this
Parameters
$targetWarehouseId : int|null
Return values
$this

setType()

public setType(int $type) : $this
Parameters
$type : int
Return values
$this

setUserId()

public setUserId(int|null $userId) : $this
Parameters
$userId : int|null
Return values
$this

setWarehouseId()

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