ProductVariant
extends ProductVariant
in package
Thin pivot: the atomic stock unit. `product` is the owning card (cascade); `stockItem` is a mapping to the Store card (nullable, set null; canonical direction is eshop to Store, like Invoicer `order_id`). The concrete many-to-one comes from the Api variant, Admin `#[EntityOf]`.
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_eshop_product_variants'
- #[TableAlias]
- 'productVariant'
Table of Contents
Properties
- $deleted : bool
- $id : int|null
- $product : TProduct|null
- $stockItem : TStockItem|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.
- getDeleted() : bool
- getId() : int|null
- getProduct() : TProduct|null
- getStockItem() : TStockItem|null
- isDeleted() : bool
- isPersisted() : bool
- setDeleted() : $this
- setId() : $this
- setProduct() : $this
- setStockItem() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$deleted
protected
bool
$deleted
= false
Attributes
- #[Column]
- $name: 'deleted'
- $type: 'boolean'
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'product_variant_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$product
protected
TProduct|null
$product
= null
Attributes
- #[JoinColumn]
- $name: 'cms_mod_eshop_products_product_id'
- $referencedColumnName: 'product_id'
- $onDelete: 'CASCADE'
- #[ManyToOne]
- $targetEntity: \App\UI\Api\Eshop\Models\Entities\Product::class
- $inversedBy: 'variants'
$stockItem
protected
TStockItem|null
$stockItem
= null
Attributes
- #[JoinColumn]
- $name: 'cms_mod_store_stock_items_stock_item_id'
- $referencedColumnName: 'stock_item_id'
- $nullable: true
- $onDelete: 'SET NULL'
- #[ManyToOne]
- $targetEntity: \App\UI\Api\Store\Models\Entities\StockItem::class
- $fetch: 'LAZY'
Methods
__construct()
public
__construct([int|null $id = null ][, mixed $product = null ][, mixed $stockItem = null ][, bool $deleted = false ]) : mixed
Parameters
- $id : int|null = null
- $product : mixed = null
- $stockItem : mixed = null
- $deleted : bool = false
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>getDeleted()
public
getDeleted() : bool
Return values
boolgetId()
public
getId() : int|null
Return values
int|nullgetProduct()
public
getProduct() : TProduct|null
Return values
TProduct|nullgetStockItem()
public
getStockItem() : TStockItem|null
Return values
TStockItem|nullisDeleted()
public
isDeleted() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolsetDeleted()
public
setDeleted(bool $deleted) : $this
Parameters
- $deleted : bool
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetProduct()
public
setProduct(TProduct|null $product) : $this
Parameters
- $product : TProduct|null
Return values
$thissetStockItem()
public
setStockItem(TStockItem|null $stockItem) : $this
Parameters
- $stockItem : TStockItem|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>