StockDocument
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait, StockMovementCollectionTrait
AbstractYes
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.
NOTE: confirm_key is a stored generated column — intentionally not mapped, Doctrine
must not know about it (otherwise it would try to INSERT it).
Tags
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'stockDocument'
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
- $id : int|null
- $insertDatetime : DateTime
- $movements : Collection<int, TMovement>
- $note : string|null
- $number : string|null
- $postedDatetime : DateTime|null
- $sourceId : int|null
- $sourceModule : int|null
- $sourceType : string|null
- $status : int
- $stornoDocumentId : int|null
- $supplierId : int|null
- $targetWarehouseId : int|null
- $type : int
- $userId : int|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
- getSupplierId() : int|null
- getTargetWarehouseId() : int|null
- getType() : int
- getUserId() : int|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
- setSupplierId() : $this
- setTargetWarehouseId() : $this
- setType() : $this
- setUserId() : $this
- 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'
$movements
protected
Collection<int, TMovement>
$movements
= new ArrayCollection()
$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
$postedDatetime
protected
DateTime|null
$postedDatetime
= null
Attributes
- #[Column]
- $name: 'posted_datetime'
- $type: 'datetime'
- $nullable: true
$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]
$stornoDocumentId
protected
int|null
$stornoDocumentId
= null
Attributes
- #[Column]
- $name: 'storno_document_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$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]
$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]
$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()
addMovement()
public
addMovement(TMovement $movement) : $this
Parameters
- $movement : TMovement
Return values
$thiscallInitMethods()
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>getId()
public
getId() : int|null
Return values
int|nullgetInsertDatetime()
public
getInsertDatetime() : DateTime
Return values
DateTimegetMovement()
public
getMovement(int $movementId) : TMovement|null
Parameters
- $movementId : int
Return values
TMovement|nullgetMovements()
public
getMovements() : Collection<int, TMovement>
Return values
Collection<int, TMovement>getNote()
public
getNote() : string|null
Return values
string|nullgetNumber()
public
getNumber() : string|null
Return values
string|nullgetPostedDatetime()
public
getPostedDatetime() : DateTime|null
Return values
DateTime|nullgetSourceId()
public
getSourceId() : int|null
Return values
int|nullgetSourceModule()
public
getSourceModule() : int|null
Return values
int|nullgetSourceType()
public
getSourceType() : string|null
Return values
string|nullgetStatus()
public
getStatus() : int
Return values
intgetStornoDocumentId()
public
getStornoDocumentId() : int|null
Return values
int|nullgetSupplierId()
public
getSupplierId() : int|null
Return values
int|nullgetTargetWarehouseId()
public
getTargetWarehouseId() : int|null
Return values
int|nullgetType()
public
getType() : int
Return values
intgetUserId()
public
getUserId() : int|null
Return values
int|nullgetWarehouseId()
public
getWarehouseId() : int|null
Return values
int|nullisPersisted()
public
isPersisted() : bool
Return values
boolmovementCollectionInit()
public
movementCollectionInit() : void
removeMovement()
public
removeMovement(TMovement $movement) : $this
Parameters
- $movement : TMovement
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
$thissetMovements()
public
setMovements(Collection<int, TMovement>|array<int, TMovement> $movements) : $this
Parameters
- $movements : Collection<int, TMovement>|array<int, TMovement>
Return values
$thissetNote()
public
setNote(string|null $note) : $this
Parameters
- $note : string|null
Return values
$thissetNumber()
public
setNumber(string|null $number) : $this
Parameters
- $number : string|null
Return values
$thissetPostedDatetime()
public
setPostedDatetime(DateTime|null $postedDatetime) : $this
Parameters
- $postedDatetime : DateTime|null
Return values
$thissetSourceId()
public
setSourceId(int|null $sourceId) : $this
Parameters
- $sourceId : int|null
Return values
$thissetSourceModule()
public
setSourceModule(int|null $sourceModule) : $this
Parameters
- $sourceModule : int|null
Return values
$thissetSourceType()
public
setSourceType(string|null $sourceType) : $this
Parameters
- $sourceType : string|null
Return values
$thissetStatus()
public
setStatus(int $status) : $this
Parameters
- $status : int
Return values
$thissetStornoDocumentId()
public
setStornoDocumentId(int|null $stornoDocumentId) : $this
Parameters
- $stornoDocumentId : int|null
Return values
$thissetSupplierId()
public
setSupplierId(int|null $supplierId) : $this
Parameters
- $supplierId : int|null
Return values
$thissetTargetWarehouseId()
public
setTargetWarehouseId(int|null $targetWarehouseId) : $this
Parameters
- $targetWarehouseId : int|null
Return values
$thissetType()
public
setType(int $type) : $this
Parameters
- $type : int
Return values
$thissetUserId()
public
setUserId(int|null $userId) : $this
Parameters
- $userId : int|null
Return values
$thissetWarehouseId()
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>