CoolCMS API

Gift extends Gift
in package

The many-to-many `offerSets` is mapped here too: the picker that selects the product sets a gift is offered with saves through the object graph.

Tags
extends
Attributes
#[Entity]
#[Table]
$name: 'cms_mod_eshop_gifts'
#[TableAlias]
'gift'

Table of Contents

Properties

$amount  : int
$available  : bool
$availableForOrder  : bool
$endDatetime  : DateTime|null
$hidden  : bool
$id  : int|null
$image  : TImage|null
$insertDatetime  : DateTime|null
$offerSets  : Collection<int, ProductSet>
$prices  : Collection<int, GiftPrice>
$priority  : int
$productSet  : TProductSet|null
$startDatetime  : DateTime|null
$translations  : Collection<int, GiftText>

Methods

__construct()  : mixed
addOfferSet()  : $this
addPrice()  : $this
addTranslation()  : $this
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
getAvailable()  : bool
getAvailableForOrder()  : bool
getEndDatetime()  : DateTime|null
getHidden()  : bool
getId()  : int|null
getImage()  : TImage|null
getInsertDatetime()  : DateTime|null
getOfferSets()  : Collection<int, TOfferSet>
getPriceForCurrency()  : TPrice|null
Returns the gift's price/threshold row for the currency, or null when there is none.
getPrices()  : Collection<int, TPrice>
getPriority()  : int
getProductSet()  : TProductSet|null
getStartDatetime()  : DateTime|null
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
isAvailable()  : bool
isHidden()  : bool
isPersisted()  : bool
removeTranslation()  : $this
setAmount()  : $this
setAvailable()  : $this
setAvailableForOrder()  : $this
setEndDatetime()  : $this
setHidden()  : $this
setId()  : $this
setImage()  : $this
setInsertDatetime()  : $this
setOfferSets()  : $this
setPrices()  : $this
setPriority()  : $this
setProductSet()  : $this
setStartDatetime()  : $this
setTranslations()  : $this
translationCollectionInit()  : void
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]

$available

protected bool $available = true
Attributes
#[Column]
$name: 'available'
$type: 'boolean'

$availableForOrder

protected bool $availableForOrder = true
Attributes
#[Column]
$name: 'available_for_order'
$type: 'boolean'

$endDatetime

protected DateTime|null $endDatetime = null
Attributes
#[Column]
$name: 'end_datetime'
$type: 'datetime'
$nullable: true

$hidden

protected bool $hidden = false
Attributes
#[Column]
$name: 'hidden'
$type: 'boolean'

$id

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

$image

protected TImage|null $image = null
Attributes
#[EntityOf]
\App\UI\Admin\System\Models\Entities\Asset::class
#[JoinColumn]
$name: 'cms_system_images_image_id'
$referencedColumnName: 'image_id'
$nullable: true
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Admin\System\Models\Entities\Asset::class
$fetch: 'LAZY'

$insertDatetime

protected DateTime|null $insertDatetime = null
Attributes
#[Column]
$name: 'insert_datetime'
$type: 'datetime'
#[ExternalReadonly]

$offerSets

protected Collection<int, ProductSet> $offerSets

product sets the gift is offered with

Attributes
#[CollectionOf]
\App\UI\Admin\Eshop\Models\Entities\ProductSet::class
#[InverseJoinColumn]
$name: 'cms_mod_eshop_product_sets_product_set_id'
$referencedColumnName: 'product_set_id'
$onDelete: 'CASCADE'
#[JoinColumn]
$name: 'cms_mod_eshop_gifts_gift_id'
$referencedColumnName: 'gift_id'
$onDelete: 'CASCADE'
#[JoinTable]
$name: 'cms_mod_eshop_gift_product_set_rel'
#[ManyToMany]
$targetEntity: \App\UI\Admin\Eshop\Models\Entities\ProductSet::class
$fetch: 'LAZY'

$prices

protected Collection<int, GiftPrice> $prices
Attributes
#[CollectionOf]
\App\UI\Admin\Eshop\Models\Entities\GiftPrice::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\Eshop\Models\Entities\GiftPrice::class
$mappedBy: 'gift'
$cascade: ['persist', 'remove']
$orphanRemoval: true
$fetch: 'LAZY'

$priority

protected int $priority = 0
Attributes
#[Column]
$name: 'priority'
$type: 'integer'

$productSet

protected TProductSet|null $productSet = null

the gift is this set (null = purely named gift)

Attributes
#[EntityOf]
\App\UI\Admin\Eshop\Models\Entities\ProductSet::class
#[JoinColumn]
$name: 'cms_mod_eshop_product_sets_product_set_id'
$referencedColumnName: 'product_set_id'
$nullable: true
$onDelete: 'SET NULL'
#[ManyToOne]
$targetEntity: \App\UI\Admin\Eshop\Models\Entities\ProductSet::class
$fetch: 'LAZY'

$startDatetime

protected DateTime|null $startDatetime = null
Attributes
#[Column]
$name: 'start_datetime'
$type: 'datetime'

$translations

protected Collection<int, GiftText> $translations
Attributes
#[CollectionOf]
\App\UI\Admin\Eshop\Models\Entities\GiftText::class
$owned: true
#[OneToMany]
$targetEntity: \App\UI\Admin\Eshop\Models\Entities\GiftText::class
$mappedBy: 'parent'
$cascade: ['persist', 'remove']
$orphanRemoval: true
$fetch: 'LAZY'

Methods

__construct()

public __construct([int|null $id = null ][, DateTime|null $startDatetime = null ][, DateTime|null $endDatetime = null ][, mixed $productSet = null ][, mixed $image = null ][, bool $available = true ][, bool $availableForOrder = true ][, bool $hidden = false ][, int $priority = 0 ][, int $amount = 1 ][, DateTime|null $insertDatetime = null ][, Collection $translations = new ArrayCollection() ][, Collection $prices = new ArrayCollection() ][, Collection $offerSets = new ArrayCollection() ]) : mixed
Parameters
$id : int|null = null
$startDatetime : DateTime|null = null
$endDatetime : DateTime|null = null
$productSet : mixed = null
$image : mixed = null
$available : bool = true
$availableForOrder : bool = true
$hidden : bool = false
$priority : int = 0
$amount : int = 1
$insertDatetime : DateTime|null = null
$translations : Collection = new ArrayCollection()
$prices : Collection = new ArrayCollection()
$offerSets : Collection = new ArrayCollection()

addOfferSet()

public addOfferSet(TOfferSet $offerSet) : $this
Parameters
$offerSet : TOfferSet
Return values
$this

addPrice()

public addPrice(TPrice $price) : $this
Parameters
$price : TPrice
Return values
$this

addTranslation()

public addTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

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

getAvailable()

public getAvailable() : bool
Return values
bool

getAvailableForOrder()

public getAvailableForOrder() : bool
Return values
bool

getEndDatetime()

public getEndDatetime() : DateTime|null
Return values
DateTime|null

getHidden()

public getHidden() : bool
Return values
bool

getImage()

public getImage() : TImage|null
Return values
TImage|null

getInsertDatetime()

public getInsertDatetime() : DateTime|null
Return values
DateTime|null

getOfferSets()

public getOfferSets() : Collection<int, TOfferSet>
Return values
Collection<int, TOfferSet>

getPriceForCurrency()

Returns the gift's price/threshold row for the currency, or null when there is none.

public getPriceForCurrency(int $currencyId) : TPrice|null
Parameters
$currencyId : int
Return values
TPrice|null

getPrices()

public getPrices() : Collection<int, TPrice>
Return values
Collection<int, TPrice>

getPriority()

public getPriority() : int
Return values
int

getProductSet()

public getProductSet() : TProductSet|null
Return values
TProductSet|null

getStartDatetime()

public getStartDatetime() : DateTime|null
Return values
DateTime|null

getTranslation()

public getTranslation(int $langId) : TTranslation|null
Parameters
$langId : int
Return values
TTranslation|null

getTranslations()

public getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>

isAvailable()

public isAvailable() : bool
Return values
bool

isHidden()

public isHidden() : bool
Return values
bool

removeTranslation()

public removeTranslation(TTranslation $translation) : $this
Parameters
$translation : TTranslation
Return values
$this

setAmount()

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

setAvailable()

public setAvailable(bool $available) : $this
Parameters
$available : bool
Return values
$this

setAvailableForOrder()

public setAvailableForOrder(bool $availableForOrder) : $this
Parameters
$availableForOrder : bool
Return values
$this

setEndDatetime()

public setEndDatetime(DateTime|null $endDatetime) : $this
Parameters
$endDatetime : DateTime|null
Return values
$this

setHidden()

public setHidden(bool $hidden) : $this
Parameters
$hidden : bool
Return values
$this

setId()

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

setImage()

public setImage(TImage|null $image) : $this
Parameters
$image : TImage|null
Return values
$this

setInsertDatetime()

public setInsertDatetime(DateTime|null $insertDatetime) : $this
Parameters
$insertDatetime : DateTime|null
Return values
$this

setOfferSets()

public setOfferSets(Collection<int, TOfferSet>|array<int, TOfferSet> $offerSets) : $this
Parameters
$offerSets : Collection<int, TOfferSet>|array<int, TOfferSet>
Return values
$this

setPrices()

public setPrices(Collection<int, TPrice>|array<int, TPrice> $prices) : $this
Parameters
$prices : Collection<int, TPrice>|array<int, TPrice>
Return values
$this

setPriority()

public setPriority(int $priority) : $this
Parameters
$priority : int
Return values
$this

setProductSet()

public setProductSet(TProductSet|null $productSet) : $this
Parameters
$productSet : TProductSet|null
Return values
$this

setStartDatetime()

public setStartDatetime(DateTime|null $startDatetime) : $this
Parameters
$startDatetime : DateTime|null
Return values
$this

setTranslations()

public setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
$translations : Collection<int, TTranslation>|array<int, TTranslation>
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