CoolCMS API

ShipperTariff extends BaseEntity
in package
implements IdentifiableInterface uses IdentifiableTrait, TranslationCollectionTrait, PriceCollectionTrait

AbstractYes

Carrier tariff. Legacy column `cms_system_regions_region_id` is not carried over.

useShipperBranches (0 = not used, 1 = all, 2 = only from one region, 3 = chosen individually) is stored as a bare int; the branches themselves are not imported, the column is kept for later binding.

The tariff owns two price collections:

  • $prices (ShipperTariffPrice) is an append-only time series of shipping prices per weight band × currency × dateFrom. Prices are entered without VAT.
  • $paymentPrices (PaymentMethodPrice) is the payment method × currency matrix (availability + surcharge, also without VAT). Also an append-only time series by dateFrom, keyed and resolved independently of $prices. It hangs on the tariff, not on a single price generation, because otherwise every new shipping price generation would start with an empty payment matrix; hence both are edited in one tariff form.

$branches (ShipperTariffBranch) are the tariff's own branches (pickup points), one tariff to many branches. Plain CRUD, no time series or immutability; edited one by one outside the main tariff form (ShipperTariffManager::saveBranch()/deleteBranch()).

IMPORTANT: the branches collection must be in EDIT_INCLUDES, otherwise orphanRemoval deletes the branches on a regular tariff save.

externalPickup: the tariff requires choosing a pickup point with the official widget of the carrier and similar. It excludes useShipperBranches: both at once would make the front end offer a branch select and a widget button together.

Tags
template
Attributes
#[MappedSuperclass]
#[TableAlias]
$alias: 'shipperTariff'

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

$branches  : Collection<int, TBranch>
$city  : string|null
$country  : string|null
$externalPickup  : bool
$id  : int|null
$latitude  : string|null
$longitude  : string|null
$paymentPrices  : Collection<int, TPaymentPrice>
$prices  : Collection<int, TPrice>
$shipper  : TShipper|null
$shipperRegion  : TShipperRegion|null
$street  : string|null
$supplyKindId  : int|null
$translations  : Collection<int, TTranslation>
$useShipperBranches  : int
$zip  : string|null

Methods

__construct()  : mixed
addBranch()  : $this
addPaymentPrice()  : $this
addPrice()  : $this
addTranslation()  : $this
callInitMethods()  : void
Calls `init{TraitName}()` for every used trait that defines such a method.
clearPrices()  : $this
getAllTraits()  : array<string, string>
Returns all traits the class uses, including those used by parent classes and nested traits.
getBranches()  : Collection<int, TBranch>
Own branches of the tariff: owned collection, plain CRUD (no time series).
getCity()  : string|null
getCountry()  : string|null
getExternalPickup()  : bool
getId()  : int|null
getLatitude()  : string|null
getLatitudeAsFloat()  : float|null
getLongitude()  : string|null
getLongitudeAsFloat()  : float|null
getPaymentPrices()  : Collection<int, TPaymentPrice>
Payment matrix of the tariff (payment method × currency): owned collection, full replace.
getPrices()  : Collection<int, TPrice>
getShipper()  : TShipper|null
getShipperRegion()  : TShipperRegion|null
getStreet()  : string|null
getSupplyKindId()  : int|null
getTranslation()  : TTranslation|null
getTranslations()  : Collection<int, TTranslation>
getUseShipperBranches()  : int
getZip()  : string|null
isExternalPickup()  : bool
isPersisted()  : bool
priceCollectionInit()  : void
removePrice()  : $this
removeTranslation()  : $this
setBranches()  : $this
setCity()  : $this
setCountry()  : $this
setExternalPickup()  : $this
setId()  : $this
setLatitude()  : $this
setLongitude()  : $this
setPaymentPrices()  : $this
setPrices()  : $this
setShipper()  : $this
setShipperRegion()  : $this
setStreet()  : $this
setSupplyKindId()  : TBranch>
setTranslations()  : $this
setUseShipperBranches()  : $this
setZip()  : $this
translationCollectionInit()  : void
getTraitsRecursive()  : array<string, string>
Walks the trait list recursively and collects nested traits too.

Properties

$branches

protected Collection<int, TBranch> $branches = new ArrayCollection()

$city

protected string|null $city = null
Attributes
#[Column]
$name: 'city'
$type: 'string'
$length: 100
$nullable: true

$country

protected string|null $country = null
Attributes
#[Column]
$name: 'country'
$type: 'string'
$length: 60
$nullable: true

$externalPickup

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

$id

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

$latitude

protected string|null $latitude = null
Attributes
#[Column]
$name: 'latitude'
$type: 'decimal'
$precision: 10
$scale: 6
$nullable: true

$longitude

protected string|null $longitude = null
Attributes
#[Column]
$name: 'longitude'
$type: 'decimal'
$precision: 10
$scale: 6
$nullable: true

$paymentPrices

protected Collection<int, TPaymentPrice> $paymentPrices = new ArrayCollection()

$prices

protected Collection<int, TPrice> $prices = new ArrayCollection()

$shipperRegion

protected TShipperRegion|null $shipperRegion = null

$street

protected string|null $street = null
Attributes
#[Column]
$name: 'street'
$type: 'string'
$length: 100
$nullable: 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()

$useShipperBranches

protected int $useShipperBranches = 0
Attributes
#[Column]
$name: 'use_shipper_branches'
$type: 'integer'
$options: ['unsigned' => true]

$zip

protected string|null $zip = null
Attributes
#[Column]
$name: 'zip'
$type: 'string'
$length: 10
$nullable: true

Methods

__construct()

public __construct([int|null $id = null ][, mixed $shipper = null ][, mixed $shipperRegion = null ][, string|null $street = null ][, string|null $city = null ][, string|null $zip = null ][, string|null $country = null ][, string|null $latitude = null ][, string|null $longitude = null ][, int $useShipperBranches = 0 ][, bool $externalPickup = false ][, Collection $translations = new ArrayCollection() ][, Collection $prices = new ArrayCollection() ][, Collection $paymentPrices = new ArrayCollection() ][, Collection $branches = new ArrayCollection() ][, int|null $supplyKindId = null ]) : mixed
Parameters
$id : int|null = null
$shipper : mixed = null
$shipperRegion : mixed = null
$street : string|null = null
$city : string|null = null
$zip : string|null = null
$country : string|null = null
$latitude : string|null = null
$longitude : string|null = null
$useShipperBranches : int = 0
$externalPickup : bool = false
$translations : Collection = new ArrayCollection()
$prices : Collection = new ArrayCollection()
$paymentPrices : Collection = new ArrayCollection()
$branches : Collection = new ArrayCollection()
$supplyKindId : int|null = null

addBranch()

public addBranch(TBranch $branch) : $this
Parameters
$branch : TBranch
Return values
$this

addPaymentPrice()

public addPaymentPrice(TPaymentPrice $paymentPrice) : $this
Parameters
$paymentPrice : TPaymentPrice
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>

getBranches()

Own branches of the tariff: owned collection, plain CRUD (no time series).

public getBranches() : Collection<int, TBranch>
Return values
Collection<int, TBranch>

getCity()

public getCity() : string|null
Return values
string|null

getCountry()

public getCountry() : string|null
Return values
string|null

getExternalPickup()

public getExternalPickup() : bool
Return values
bool

getLatitude()

public getLatitude() : string|null
Return values
string|null

getLatitudeAsFloat()

public getLatitudeAsFloat() : float|null
Return values
float|null

getLongitude()

public getLongitude() : string|null
Return values
string|null

getLongitudeAsFloat()

public getLongitudeAsFloat() : float|null
Return values
float|null

getPaymentPrices()

Payment matrix of the tariff (payment method × currency): owned collection, full replace.

public getPaymentPrices() : Collection<int, TPaymentPrice>
Return values
Collection<int, TPaymentPrice>

getPrices()

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

getShipper()

public getShipper() : TShipper|null
Return values
TShipper|null

getShipperRegion()

public getShipperRegion() : TShipperRegion|null
Return values
TShipperRegion|null

getStreet()

public getStreet() : string|null
Return values
string|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>

getUseShipperBranches()

public getUseShipperBranches() : int
Return values
int

getZip()

public getZip() : string|null
Return values
string|null

isExternalPickup()

public isExternalPickup() : bool
Return values
bool

removePrice()

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

removeTranslation()

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

setBranches()

public setBranches(Collection<int, TBranch>|array<int, TBranch> $branches) : $this
Parameters
$branches : Collection<int, TBranch>|array<int, TBranch>
Return values
$this

setCity()

public setCity(string|null $city) : $this
Parameters
$city : string|null
Return values
$this

setCountry()

public setCountry(string|null $country) : $this
Parameters
$country : string|null
Return values
$this

setExternalPickup()

public setExternalPickup(bool $externalPickup) : $this
Parameters
$externalPickup : bool
Return values
$this

setId()

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

setLatitude()

public setLatitude(string|null $latitude) : $this
Parameters
$latitude : string|null
Return values
$this

setLongitude()

public setLongitude(string|null $longitude) : $this
Parameters
$longitude : string|null
Return values
$this

setPaymentPrices()

public setPaymentPrices(Collection<int, TPaymentPrice>|array<int, TPaymentPrice> $paymentPrices) : $this
Parameters
$paymentPrices : Collection<int, TPaymentPrice>|array<int, TPaymentPrice>
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

setShipper()

public setShipper(TShipper|null $shipper) : $this
Parameters
$shipper : TShipper|null
Return values
$this

setShipperRegion()

public setShipperRegion(TShipperRegion|null $shipperRegion) : $this
Parameters
$shipperRegion : TShipperRegion|null
Return values
$this

setStreet()

public setStreet(string|null $street) : $this
Parameters
$street : string|null
Return values
$this

setSupplyKindId()

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

setTranslations()

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

setUseShipperBranches()

public setUseShipperBranches(int $useShipperBranches) : $this
Parameters
$useShipperBranches : int
Return values
$this

setZip()

public setZip(string|null $zip) : $this
Parameters
$zip : string|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