CoolCMS API

CartVoucher extends CartVoucher
in package

Discount code applied in a persistent cart: only the code, no validation or value (price and validity are always verified by checkout, not by the cart).

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_mod_eshop_cart_vouchers'
#[TableAlias]
'cartVoucher'

Table of Contents

Properties

$cart  : TCart|null
$code  : string
$id  : int|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.
getCart()  : TCart|null
getCode()  : string
getId()  : int|null
isPersisted()  : bool
setCart()  : $this
setCode()  : $this
setId()  : $this
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$cart

protected TCart|null $cart = null
Attributes
#[JoinColumn]
$name: 'cms_mod_eshop_carts_cart_id'
$referencedColumnName: 'cart_id'
$nullable: false
$onDelete: 'CASCADE'
#[ManyToOne]
$targetEntity: \App\UI\Api\Eshop\Models\Entities\Cart::class
$inversedBy: 'vouchers'
$fetch: 'LAZY'

$code

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

$id

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

Methods

__construct()

public __construct([int|null $id = null ][, mixed $cart = null ][, string $code = '' ]) : mixed
Parameters
$id : int|null = null
$cart : mixed = null
$code : string = ''

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>

getCart()

public getCart() : TCart|null
Return values
TCart|null

getCode()

public getCode() : string
Return values
string

setCart()

public setCart(TCart|null $cart) : $this
Parameters
$cart : TCart|null
Return values
$this

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

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