CoolCMS API

ProductVariant extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait

AbstractYes

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
template
Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'productVariant'

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

$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

$id

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

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>

getProduct()

public getProduct() : TProduct|null
Return values
TProduct|null

getStockItem()

public getStockItem() : TStockItem|null
Return values
TStockItem|null

setDeleted()

public setDeleted(bool $deleted) : $this
Parameters
$deleted : bool
Return values
$this

setId()

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

setProduct()

public setProduct(TProduct|null $product) : $this
Parameters
$product : TProduct|null
Return values
$this

setStockItem()

public setStockItem(TStockItem|null $stockItem) : $this
Parameters
$stockItem : TStockItem|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