CoolCMS API

OrderVoucher extends OrderVoucher
in package

Snapshot of a voucher applied to an order (table `cms_mod_eshop_order_voucher_rel`).

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_mod_eshop_order_voucher_rel'
#[TableAlias]
'orderVoucher'

Table of Contents

Properties

$code  : string
$id  : int|null
$order  : TOrder|null
$percents  : int
$price  : string
$priceWithVat  : string
$vat  : string
$voucher  : TVoucher|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.
getCode()  : string
getId()  : int|null
getOrder()  : TOrder|null
getPercents()  : int
getPrice()  : string
getPriceWithVat()  : string
getVat()  : string
getVatAsFloat()  : float
getVoucher()  : TVoucher|null
isPersisted()  : bool
setCode()  : $this
setId()  : $this
setOrder()  : $this
setPercents()  : $this
setPrice()  : $this
setPriceWithVat()  : $this
setVat()  : $this
setVoucher()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$code

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

$id

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

$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: 'vouchers'
$fetch: 'LAZY'
#[ParentRef]

$percents

protected int $percents = 0
Attributes
#[Column]
$name: 'percents'
$type: 'integer'
$options: ['unsigned' => true]
#[ExternalReadonly]

$price

protected string $price = '0.000'
Attributes
#[Column]
$name: 'price'
$type: 'decimal'
$precision: 10
$scale: 3
#[ExternalReadonly]

$priceWithVat

protected string $priceWithVat = '0.000'
Attributes
#[Column]
$name: 'price_with_vat'
$type: 'decimal'
$precision: 10
$scale: 3
#[ExternalReadonly]

$voucher

protected TVoucher|null $voucher = null
Attributes
#[EntityOf]
\App\UI\Admin\Eshop\Models\Entities\Voucher::class
#[JoinColumn]
$name: 'cms_mod_eshop_vouchers_voucher_id'
$referencedColumnName: 'voucher_id'
$nullable: true
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Admin\Eshop\Models\Entities\Voucher::class
$fetch: 'LAZY'

Methods

__construct()

public __construct([int|null $id = null ][, mixed $order = null ][, mixed $voucher = null ][, string $code = '' ][, int $percents = 0 ][, string $price = '0.000' ][, string $priceWithVat = '0.000' ][, string $vat = '0.00' ]) : mixed
Parameters
$id : int|null = null
$order : mixed = null
$voucher : mixed = null
$code : string = ''
$percents : int = 0
$price : string = '0.000'
$priceWithVat : string = '0.000'
$vat : string = '0.00'

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>

getCode()

public getCode() : string
Return values
string

getOrder()

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

getPercents()

public getPercents() : int
Return values
int

getPrice()

public getPrice() : string
Return values
string

getPriceWithVat()

public getPriceWithVat() : string
Return values
string

getVatAsFloat()

public getVatAsFloat() : float
Return values
float

getVoucher()

public getVoucher() : TVoucher|null
Return values
TVoucher|null

setCode()

public setCode(string $code) : $this
Parameters
$code : string
Return values
$this

setId()

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

setOrder()

public setOrder(TOrder|null $order) : $this
Parameters
$order : TOrder|null
Return values
$this

setPercents()

public setPercents(int $percents) : $this
Parameters
$percents : int
Return values
$this

setPrice()

public setPrice(string $price) : $this
Parameters
$price : string
Return values
$this

setPriceWithVat()

public setPriceWithVat(string $priceWithVat) : $this
Parameters
$priceWithVat : string
Return values
$this

setVat()

public setVat(string $vat) : $this
Parameters
$vat : string
Return values
$this

setVoucher()

public setVoucher(TVoucher|null $voucher) : $this
Parameters
$voucher : TVoucher|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