ShipperTariffPrice
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait
Tariff price: an append-only time series per weight interval × currency × validity date (`dateFrom`). Unlike {@see ProductSetFeePrice}/{@see ProductSetPrice} (composite PK without surrogate id, where `publishedTime` must be ORM `type: 'string'`), this entity keeps a surrogate auto-increment `id`, so `dateFrom` is not part of the Doctrine identifier and is a normal `type: 'datetime'` column. The property is `\DateTime`, not `\DateTimeImmutable`: the DBAL `datetime` type accepts only `\DateTime` (the immutable one needs `datetime_immutable`).
currencyId stays a scalar int (a price series axis, no JOIN needed), like
ProductSetFeePrice::$currencyId and ProductSetPrice::$currencyId. Weights are decimal
(not float) for exact string comparison on interval edges.
weightTo === null is a band without an upper bound ("from X kg up"), typically the last
band. A generation may hold at most one such band and it must have the highest weightFrom
of the generation, otherwise the open band would overlap the ones above it. Only the admin
tariff form enforces this (the Api manager does not), not the database: a mysql unique index treats
each null as distinct, so a unique over (tariff, currency, date_from, weight_from,
weight_to) lets two open bands through. Consumers of getWeightTo()/getWeightToAsFloat()
must treat null as infinity; in sql write (weight_to is null or weight_to >= :w).
active is the per currency × band checkbox. ShippingPriceResolver does not filter it in sql: when the
newest matching row is active = 0, the tariff is not offered for that weight and currency
(no fallback to an older generation). The row and its history stay in the database, like
available in PaymentMethodPrice. It is not the same as deleting the band.
Tags
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'shipperTariffPrice'
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
- $currencyId : int|null
- $dateFrom : DateTime|null
- $freeFrom : string|null
- $id : int|null
- $price : string
- $tariff : TShipperTariff|null
- $vat : TVat|null
- $weightFrom : string
- $weightTo : string|null
Methods
- __construct() : mixed
- callInitMethods() : void
- Calls `init{TraitName}()` for every used trait that defines such a method.
- getActive() : bool
- getAllTraits() : array<string, string>
- Returns all traits the class uses, including those used by parent classes and nested traits.
- getCurrencyId() : int|null
- getDateFrom() : DateTime|null
- getFreeFrom() : string|null
- getFreeFromAsFloat() : float|null
- getId() : int|null
- getPrice() : string
- getPriceAsFloat() : float
- getTariff() : TShipperTariff|null
- getVat() : TVat|null
- getWeightFrom() : string
- getWeightFromAsFloat() : float
- getWeightTo() : string|null
- getWeightToAsFloat() : float|null
- isActive() : bool
- isPersisted() : bool
- setActive() : $this
- setCurrencyId() : $this
- setDateFrom() : $this
- setFreeFrom() : $this
- setId() : $this
- setPrice() : $this
- setTariff() : $this
- setVat() : $this
- setWeightFrom() : $this
- setWeightTo() : $this
- 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'
- $options: ['default' => true]
$currencyId
protected
int|null
$currencyId
= null
Attributes
- #[Column]
- $name: 'cms_system_currencies_currency_id'
- $type: 'integer'
- $options: ['unsigned' => true]
$dateFrom
protected
DateTime|null
$dateFrom
= null
Attributes
- #[Column]
- $name: 'date_from'
- $type: 'datetime'
$freeFrom
protected
string|null
$freeFrom
= null
Attributes
- #[Column]
- $name: 'free_from'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $nullable: true
$id
protected
int|null
$id
= null
Attributes
- #[Column]
- $name: 'shipper_tariff_price_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$price
protected
string
$price
= '0.000'
Attributes
- #[Column]
- $name: 'price'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$tariff
protected
TShipperTariff|null
$tariff
= null
$vat
protected
TVat|null
$vat
= null
$weightFrom
protected
string
$weightFrom
= '0.000'
Attributes
- #[Column]
- $name: 'weight_from'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $options: ['unsigned' => true]
$weightTo
protected
string|null
$weightTo
= null
Attributes
- #[Column]
- $name: 'weight_to'
- $type: 'decimal'
- $precision: 10
- $scale: 3
- $nullable: true
- $options: ['unsigned' => true]
Methods
__construct()
public
__construct([int|null $id = null ][, mixed $tariff = null ][, int|null $currencyId = null ][, mixed $vat = null ][, DateTime|null $dateFrom = null ][, string $weightFrom = '0.000' ][, string|null $weightTo = null ][, string $price = '0.000' ][, bool $active = true ][, string|null $freeFrom = null ]) : mixed
Parameters
- $id : int|null = null
- $tariff : mixed = null
- $currencyId : int|null = null
- $vat : mixed = null
- $dateFrom : DateTime|null = null
- $weightFrom : string = '0.000'
- $weightTo : string|null = null
- $price : string = '0.000'
- $active : bool = true
- $freeFrom : string|null = null
callInitMethods()
Calls `init{TraitName}()` for every used trait that defines such a method.
public
callInitMethods() : void
getActive()
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>getCurrencyId()
public
getCurrencyId() : int|null
Return values
int|nullgetDateFrom()
public
getDateFrom() : DateTime|null
Return values
DateTime|nullgetFreeFrom()
public
getFreeFrom() : string|null
Return values
string|nullgetFreeFromAsFloat()
public
getFreeFromAsFloat() : float|null
Return values
float|nullgetId()
public
getId() : int|null
Return values
int|nullgetPrice()
public
getPrice() : string
Return values
stringgetPriceAsFloat()
public
getPriceAsFloat() : float
Return values
floatgetTariff()
public
getTariff() : TShipperTariff|null
Return values
TShipperTariff|nullgetVat()
public
getVat() : TVat|null
Return values
TVat|nullgetWeightFrom()
public
getWeightFrom() : string
Return values
stringgetWeightFromAsFloat()
public
getWeightFromAsFloat() : float
Return values
floatgetWeightTo()
public
getWeightTo() : string|null
Return values
string|nullgetWeightToAsFloat()
public
getWeightToAsFloat() : float|null
Return values
float|nullisActive()
public
isActive() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolsetActive()
public
setActive(bool $active) : $this
Parameters
- $active : bool
Return values
$thissetCurrencyId()
public
setCurrencyId(int|null $currencyId) : $this
Parameters
- $currencyId : int|null
Return values
$thissetDateFrom()
public
setDateFrom(DateTime|null $dateFrom) : $this
Parameters
- $dateFrom : DateTime|null
Return values
$thissetFreeFrom()
public
setFreeFrom(string|null $freeFrom) : $this
Parameters
- $freeFrom : string|null
Return values
$thissetId()
public
setId(int|null $id) : $this
Parameters
- $id : int|null
Return values
$thissetPrice()
public
setPrice(string $price) : $this
Parameters
- $price : string
Return values
$thissetTariff()
public
setTariff(TShipperTariff|null $tariff) : $this
Parameters
- $tariff : TShipperTariff|null
Return values
$thissetVat()
public
setVat(TVat|null $vat) : $this
Parameters
- $vat : TVat|null
Return values
$thissetWeightFrom()
public
setWeightFrom(string $weightFrom) : $this
Parameters
- $weightFrom : string
Return values
$thissetWeightTo()
public
setWeightTo(string|null $weightTo) : $this
Parameters
- $weightTo : string|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>