CoolCMS API

OrderGift extends OrderGift
in package

Snapshot of a gift on an order: only name and amount; it does not enter `total_price`. The gift is a reference only (`SET NULL`).

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_mod_eshop_order_gifts'
#[TableAlias]
'orderGift'

Table of Contents

Properties

$amount  : int
$gift  : TGift|null
$id  : int|null
$name  : string
$order  : TOrder|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.
getAmount()  : int
getGift()  : TGift|null
getId()  : int|null
getName()  : string
getOrder()  : TOrder|null
isPersisted()  : bool
setAmount()  : $this
setGift()  : $this
setId()  : $this
setName()  : $this
setOrder()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$amount

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

$gift

protected TGift|null $gift = null
Attributes
#[EntityOf]
\App\UI\Admin\Eshop\Models\Entities\Gift::class
#[JoinColumn]
$name: 'cms_mod_eshop_gifts_gift_id'
$referencedColumnName: 'gift_id'
$nullable: true
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Admin\Eshop\Models\Entities\Gift::class
$fetch: 'LAZY'

$id

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

$name

protected string $name = ''
Attributes
#[Column]
$name: 'name'
$type: 'string'
$length: 255

$order

protected TOrder|null $order = null
Attributes
#[JoinColumn]
$name: 'cms_mod_eshop_orders_order_id'
$referencedColumnName: 'order_id'
$nullable: false
$onDelete: 'CASCADE'
#[ManyToOne]
$targetEntity: \App\UI\Admin\Eshop\Models\Entities\Order::class
$inversedBy: 'gifts'
$fetch: 'LAZY'
#[ParentRef]

Methods

__construct()

public __construct([int|null $id = null ][, mixed $order = null ][, mixed $gift = null ][, string $name = '' ][, int $amount = 1 ]) : mixed
Parameters
$id : int|null = null
$order : mixed = null
$gift : mixed = null
$name : string = ''
$amount : int = 1

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>

getAmount()

public getAmount() : int
Return values
int

getGift()

public getGift() : TGift|null
Return values
TGift|null

getName()

public getName() : string
Return values
string

getOrder()

public getOrder() : TOrder|null
Return values
TOrder|null

setAmount()

public setAmount(int $amount) : $this
Parameters
$amount : int
Return values
$this

setGift()

public setGift(TGift|null $gift) : $this
Parameters
$gift : TGift|null
Return values
$this

setId()

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

setName()

public setName(string $name) : $this
Parameters
$name : string
Return values
$this

setOrder()

public setOrder(TOrder|null $order) : $this
Parameters
$order : TOrder|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