Tariff
extends Tariff
in package
Admin variant of an advert tariff, hydrated from `api/bazaar/tariff`.
Maps the translations (name, title, description), the prices per payment region and
gateway, and the express prices per payment region. Region, gateway and currency are scalar
FKs in the prices (mirrors the Front).
Tags
Attributes
- #[Entity]
- #[Table]
- $name: 'cms_mod_bazaar_advert_tariffs'
- #[TableAlias]
- 'tariff'
Table of Contents
Properties
- $active : bool
- $credits : int
- $duration : int
- $id : int|null
- $prices : Collection<int, TariffPrice>
- $productTypeId : int|null
- $quickPrices : Collection<int, TariffQuickPrice>
- $supplyKindId : int|null
- $translations : Collection<int, TariffText>
- $vatPercents : numeric-string|null
Methods
- __construct() : mixed
- addPrice() : $this
- addQuickPrice() : $this
- addTranslation() : $this
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- clearPrices() : $this
- clearQuickPrices() : $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
- getQuickPrice() : TQuickPrice|null
- getQuickPrices() : Collection<int, TQuickPrice>
- getSupplyKindId() : int|null
- getTranslation() : TTranslation|null
- getTranslations() : Collection<int, TTranslation>
- getVatPercents() : numeric-string|null
- isActive() : bool
- isPersisted() : bool
- removePrice() : $this
- removeQuickPrice() : $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() : TQuickPrice>
- setQuickPrices() : $this
- setSupplyKindId() : TQuickPrice>
- setTranslations() : $this
- setVatPercents() : TQuickPrice>
- tariffPriceCollectionInit() : void
- tariffQuickPriceCollectionInit() : 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]
- $name: 'active'
- $type: 'boolean'
$credits
protected
int
$credits
= 0
Attributes
- #[Column]
- $name: 'credits'
- $type: 'integer'
- $options: ['unsigned' => true]
$duration
protected
int
$duration
= 0
Attributes
- #[Column]
- $name: 'duration'
- $type: 'integer'
- $options: ['unsigned' => true]
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'advert_tariff_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$prices
protected
Collection<int, TariffPrice>
$prices
Attributes
- #[CollectionOf]
- \App\UI\Admin\Bazaar\Models\Entities\TariffPrice::class
- $owned: true
- #[OneToMany]
- $targetEntity: \App\UI\Admin\Bazaar\Models\Entities\TariffPrice::class
- $mappedBy: 'tariff'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$productTypeId
protected
int|null
$productTypeId
= null
Attributes
- #[Column]
- $name: 'cms_mod_invoicer_product_types_product_type_id'
- $type: 'integer'
- $nullable: true
- $options: ['unsigned' => true]
$quickPrices
protected
Collection<int, TariffQuickPrice>
$quickPrices
Attributes
- #[CollectionOf]
- \App\UI\Admin\Bazaar\Models\Entities\TariffQuickPrice::class
- $owned: true
- #[OneToMany]
- $targetEntity: \App\UI\Admin\Bazaar\Models\Entities\TariffQuickPrice::class
- $mappedBy: 'tariff'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$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, TariffText>
$translations
Attributes
- #[CollectionOf]
- \App\UI\Admin\Bazaar\Models\Entities\TariffText::class
- $owned: true
- #[OneToMany]
- $targetEntity: \App\UI\Admin\Bazaar\Models\Entities\TariffText::class
- $mappedBy: 'parent'
- $cascade: ["persist", "remove"]
- $orphanRemoval: true
- $fetch: "LAZY"
$vatPercents
protected
numeric-string|null
$vatPercents
= null
Attributes
- #[Column]
- $name: 'vat_percents'
- $type: 'decimal'
- $precision: 5
- $scale: 2
- $nullable: true
Methods
__construct()
public
__construct([int|null $id = null ][, int $duration = 0 ][, int $credits = 0 ][, bool $active = true ][, int|null $productTypeId = null ][, string|null $vatPercents = null ][, Collection $translations = new ArrayCollection() ][, Collection $prices = new ArrayCollection() ][, Collection $quickPrices = new ArrayCollection() ][, int|null $supplyKindId = null ]) : mixed
Parameters
- $id : int|null = null
- $duration : int = 0
- $credits : int = 0
- $active : bool = true
- $productTypeId : int|null = null
- $vatPercents : string|null = null
- $translations : Collection = new ArrayCollection()
- $prices : Collection = new ArrayCollection()
- $quickPrices : Collection = new ArrayCollection()
- $supplyKindId : int|null = null
addPrice()
public
addPrice(TPrice $price) : $this
Parameters
- $price : TPrice
Return values
$thisaddQuickPrice()
public
addQuickPrice(TQuickPrice $quickPrice) : $this
Parameters
- $quickPrice : TQuickPrice
Return values
$thisaddTranslation()
public
addTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thiscallInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
clearPrices()
public
clearPrices() : $this
Return values
$thisclearQuickPrices()
public
clearQuickPrices() : $this
Return values
$thisgetActive()
public
getActive() : bool
Return values
boolgetAllTraits()
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
intgetDuration()
public
getDuration() : int
Return values
intgetId()
public
getId() : int|null
Return values
int|nullgetPrice()
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|nullgetPrices()
public
getPrices() : Collection<int, TPrice>
Return values
Collection<int, TPrice>getProductTypeId()
public
getProductTypeId() : int|null
Return values
int|nullgetQuickPrice()
public
getQuickPrice(int $paymentRegionId) : TQuickPrice|null
Parameters
- $paymentRegionId : int
Return values
TQuickPrice|nullgetQuickPrices()
public
getQuickPrices() : Collection<int, TQuickPrice>
Return values
Collection<int, TQuickPrice>getSupplyKindId()
public
getSupplyKindId() : int|null
Return values
int|nullgetTranslation()
public
getTranslation(int $langId) : TTranslation|null
Parameters
- $langId : int
Return values
TTranslation|nullgetTranslations()
public
getTranslations() : Collection<int, TTranslation>
Return values
Collection<int, TTranslation>getVatPercents()
public
getVatPercents() : numeric-string|null
Return values
numeric-string|nullisActive()
public
isActive() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolremovePrice()
public
removePrice(TPrice $price) : $this
Parameters
- $price : TPrice
Return values
$thisremoveQuickPrice()
public
removeQuickPrice(TQuickPrice $quickPrice) : $this
Parameters
- $quickPrice : TQuickPrice
Return values
$thisremoveTranslation()
public
removeTranslation(TTranslation $translation) : $this
Parameters
- $translation : TTranslation
Return values
$thissetActive()
public
setActive(bool $active) : $this
Parameters
- $active : bool
Return values
$thissetCredits()
public
setCredits(int $credits) : $this
Parameters
- $credits : int
Return values
$thissetDuration()
public
setDuration(int $duration) : $this
Parameters
- $duration : int
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetPrices()
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
$thissetProductTypeId()
public
setProductTypeId(int|null $productTypeId) : TQuickPrice>
Parameters
- $productTypeId : int|null
Return values
TQuickPrice>setQuickPrices()
public
setQuickPrices(Collection<int, TQuickPrice>|array<int, TQuickPrice> $quickPrices) : $this
Parameters
- $quickPrices : Collection<int, TQuickPrice>|array<int, TQuickPrice>
Return values
$thissetSupplyKindId()
public
setSupplyKindId(int|null $supplyKindId) : TQuickPrice>
Parameters
- $supplyKindId : int|null
Return values
TQuickPrice>setTranslations()
public
setTranslations(Collection<int, TTranslation>|array<int, TTranslation> $translations) : $this
Parameters
- $translations : Collection<int, TTranslation>|array<int, TTranslation>
Return values
$thissetVatPercents()
public
setVatPercents(int|float|string|null $vatPercents) : TQuickPrice>
Parameters
- $vatPercents : int|float|string|null
Return values
TQuickPrice>tariffPriceCollectionInit()
public
tariffPriceCollectionInit() : void
tariffQuickPriceCollectionInit()
public
tariffQuickPriceCollectionInit() : void
translationCollectionInit()
public
translationCollectionInit() : void
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>