CoolCMS API

Tariff extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait, TranslationCollectionTrait, TariffPriceCollectionTrait

AbstractYes
Tags
template
Attributes
#[MappedSuperclass]

Table of Contents

Interfaces

IdentifiableInterface
Entity with a simple integer primary key. Most entities have one (often via {@see \App\Core\Traits\Shared\Models\Entities\IdentifiableTrait}); texts and links with a composite key do not, which is why `getId()` is not on {@see \App\Core\Base\BaseEntity}. Code that needs the id of a generic entity asks for this interface (parameter type, template bound, `instanceof`).

Properties

$active  : bool
$credits  : int
$duration  : int
$id  : int|null
$prices  : Collection<int, TPrice>
$productTypeId  : int|null
$supplyKindId  : int|null
$translations  : Collection<int, TTranslation>
$vatPercents  : numeric-string|null

Methods

__construct()  : mixed
addPrice()  : $this
addTranslation()  : $this
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
clearPrices()  : $this
getActive()  : bool
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getCredits()  : int
getDuration()  : int
getId()  : int|null
getPrice()  : TPrice|null
getPrices()  : Collection<int, TPrice>
getProductTypeId()  : int|null
getSupplyKindId()  : int|null
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
getVatPercents()  : numeric-string|null
isActive()  : bool
isPersisted()  : bool
removePrice()  : $this
removeTranslation()  : $this
setActive()  : $this
setCredits()  : $this
setDuration()  : $this
setId()  : $this
setPrices()  : $this
IMPORTANT: the parameter type must be `Collection`, not `ArrayCollection`; the keep branch of the Api `SaveTrait` passes a `PersistentCollection` from a managed entity, and a narrower type throws a `TypeError` and fails the tariff save in the admin.
setProductTypeId()  : TPriceRel>
setSupplyKindId()  : TPriceRel>
setTranslations()  : $this
setVatPercents()  : TPriceRel>
tariffPriceCollectionInit()  : void
translationCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$active

protected bool $active = true
Attributes
#[Column]
$type: "boolean"
$name: "active"
$options: ["default" => 1]

$credits

protected int $credits = 0
Attributes
#[Column]
$type: "integer"
$name: "credits"
$options: ["default" => 0]

$duration

protected int $duration = 7
Attributes
#[Column]
$type: "integer"
$name: "duration"
$options: ["default" => 7]

$id

protected int|null $id = null
Attributes
#[Column]
$type: "integer"
$name: "user_tariff_id"
#[GeneratedValue]
#[Id]

$prices

protected Collection<int, TPrice> $prices = new ArrayCollection()
Attributes
#[Transient]

$productTypeId

protected int|null $productTypeId = null
Attributes
#[Column]
$type: "integer"
$name: "cms_mod_invoicer_product_types_product_type_id"
$nullable: true
$options: ["unsigned" => true]

$supplyKindId

protected int|null $supplyKindId = null
Attributes
#[Column]
$name: 'cms_system_supply_kinds_supply_kind_id'
$type: 'integer'
$nullable: true
$options: ['unsigned' => true]

$translations

protected Collection<int, TTranslation> $translations = new ArrayCollection()
Attributes
#[Transient]

$vatPercents

protected numeric-string|null $vatPercents = null
Attributes
#[Column]
$type: "decimal"
$precision: 5
$scale: 2
$name: "vat_percents"
$nullable: true

Methods

__construct()

public __construct([int|null $id = null ][, int $duration = 7 ][, int $credits = 0 ][, bool $active = true ][, int|null $productTypeId = null ][, string|null $vatPercents = null ][, Collection $translations = new ArrayCollection() ][, Collection $prices = new ArrayCollection() ][, int|null $supplyKindId = null ]) : mixed
Parameters
$id : int|null = null
$duration : int = 7
$credits : int = 0
$active : bool = true
$productTypeId : int|null = null
$vatPercents : string|null = null
$translations : Collection = new ArrayCollection()
$prices : Collection = new ArrayCollection()
$supplyKindId : int|null = null

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

getActive()

public getActive() : bool
Return values
bool

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>

getCredits()

public getCredits() : int
Return values
int

getDuration()

public getDuration() : int
Return values
int

getPrice()

public getPrice([int|null $paymentRegionId = null ][, int|null $paymentGateId = null ][, int|null $currencyId = null ]) : TPrice|null
Parameters
$paymentRegionId : int|null = null
$paymentGateId : int|null = null
$currencyId : int|null = null
Return values
TPrice|null

getProductTypeId()

public getProductTypeId() : int|null
Return values
int|null

getSupplyKindId()

public getSupplyKindId() : int|null
Return values
int|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>

getVatPercents()

public getVatPercents() : numeric-string|null
Return values
numeric-string|null

isActive()

public isActive() : bool
Return values
bool

removeTranslation()

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

setActive()

public setActive(bool $active) : $this
Parameters
$active : bool
Return values
$this

setCredits()

public setCredits(int $credits) : $this
Parameters
$credits : int
Return values
$this

setDuration()

public setDuration(int $duration) : $this
Parameters
$duration : int
Return values
$this

setId()

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

setPrices()

IMPORTANT: the parameter type must be `Collection`, not `ArrayCollection`; the keep branch of the Api `SaveTrait` passes a `PersistentCollection` from a managed entity, and a narrower type throws a `TypeError` and fails the tariff save in the admin.

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

setProductTypeId()

public setProductTypeId(int|null $productTypeId) : TPriceRel>
Parameters
$productTypeId : int|null
Return values
TPriceRel>

setSupplyKindId()

public setSupplyKindId(int|null $supplyKindId) : TPriceRel>
Parameters
$supplyKindId : int|null
Return values
TPriceRel>

setTranslations()

public setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
$translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$this

setVatPercents()

public setVatPercents(int|float|string|null $vatPercents) : TPriceRel>
Parameters
$vatPercents : int|float|string|null
Return values
TPriceRel>

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