OrderVoucher
extends OrderVoucher
in package
Snapshot of a voucher applied to an order (table `cms_mod_eshop_order_voucher_rel`).
Tags
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]
$price
protected
string
$price
= '0.000'
Attributes
- #[Column]
- $name: 'price'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$priceWithVat
protected
string
$priceWithVat
= '0.000'
Attributes
- #[Column]
- $name: 'price_with_vat'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$vat
protected
string
$vat
= '0.00'
Attributes
- #[Column]
- $name: 'vat'
- $type: 'decimal'
- $precision: 5
- $scale: 2
$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
stringgetId()
public
getId() : int|null
Return values
int|nullgetOrder()
public
getOrder() : TOrder|null
Return values
TOrder|nullgetPercents()
public
getPercents() : int
Return values
intgetPrice()
public
getPrice() : string
Return values
stringgetPriceWithVat()
public
getPriceWithVat() : string
Return values
stringgetVat()
public
getVat() : string
Return values
stringgetVatAsFloat()
public
getVatAsFloat() : float
Return values
floatgetVoucher()
public
getVoucher() : TVoucher|null
Return values
TVoucher|nullisPersisted()
public
isPersisted() : bool
Return values
boolsetCode()
public
setCode(string $code) : $this
Parameters
- $code : string
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetOrder()
public
setOrder(TOrder|null $order) : $this
Parameters
- $order : TOrder|null
Return values
$thissetPercents()
public
setPercents(int $percents) : $this
Parameters
- $percents : int
Return values
$thissetPrice()
public
setPrice(string $price) : $this
Parameters
- $price : string
Return values
$thissetPriceWithVat()
public
setPriceWithVat(string $priceWithVat) : $this
Parameters
- $priceWithVat : string
Return values
$thissetVat()
public
setVat(string $vat) : $this
Parameters
- $vat : string
Return values
$thissetVoucher()
public
setVoucher(TVoucher|null $voucher) : $this
Parameters
- $voucher : TVoucher|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>