PaymentMethodPrice
extends BaseEntity
in package
implements
IdentifiableInterface
uses
IdentifiableTrait
Price-list matrix of payment method availability and surcharge per tariff × method × currency.
It is an append-only time series with its own dateFrom, not just the current state. Each
save of a generation in the tariff edit writes a new set of rows valid from the given date;
older rows stay as history and are never overwritten or deleted.
The surcharge generation is independent of the shipping price generation (ShipperTariffPrice). Both come from the same form and usually share dateFrom, but they
are keyed and resolved separately. Binding availability or surcharge to a row of the
shipping price series would blank the payment matrix on every shipping repricing.
IMPORTANT: the latest valid row is looked up per cell (tariff × method × currency), never as
the last generation as a whole. Taking the newest dateFrom of the tariff and filtering all
methods by it would turn untouched methods of a partially filled generation into unavailable
or unpriced ones. So max(date_from) where date_from <= :at is evaluated separately for
each (tariff, paymentMethod, currency).
The PK is a surrogate payment_method_price_id, not date_from: Doctrine fails on a
composite PK containing a DateTime (hence publishedTime in ProductSetPrice is
mapped as type: 'string'). In an owned collection with orphanRemoval it would be worse:
the hydrator's findExistingChild compares identity parts as strings, so any date format
drift (seconds, timezone, Y-m-d versus Y-m-d H:i:s) would make a submitted row not match
the existing one, and orphanRemoval would silently delete the whole history.
dateFrom is a \DateTime, not \DateTimeImmutable: the DBAL datetime type does not
accept the immutable one (same as ShipperTariffPrice::$dateFrom). currencyId stays
a scalar int (a matrix axis, no JOIN needed), like ProductSetFeePrice::$currencyId.
Deactivating a payment method for a tariff is a new generation with available = 0, never a
row deletion (history must stay auditable). price is entered without VAT; the rate is
applied when the order is calculated.
Tags
Attributes
- #[MappedSuperclass]
- #[TableAlias]
- $alias: 'paymentMethodPrice'
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
- $available : bool
- $currencyId : int|null
- $dateFrom : DateTime|null
- $freeFrom : string|null
- $id : int|null
- $paymentMethod : TPaymentMethod|null
- $price : string
- $tariff : TShipperTariff|null
- $useFreeFrom : bool
Methods
- __construct() : mixed
- 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.
- getAvailable() : bool
- getCurrencyId() : int|null
- getDateFrom() : DateTime|null
- getFreeFrom() : string|null
- getFreeFromAsFloat() : float|null
- getId() : int|null
- getPaymentMethod() : TPaymentMethod|null
- getPrice() : string
- getPriceAsFloat() : float
- getTariff() : TShipperTariff|null
- getUseFreeFrom() : bool
- isAvailable() : bool
- isPersisted() : bool
- isUseFreeFrom() : bool
- setAvailable() : $this
- setCurrencyId() : $this
- setDateFrom() : $this
- setFreeFrom() : $this
- setId() : $this
- setPaymentMethod() : $this
- setPrice() : $this
- setTariff() : $this
- setUseFreeFrom() : $this
- getTraitsRecursive() : array<string, string>
- Walks the trait list recursively and collects nested traits too.
Properties
$available
protected
bool
$available
= false
Attributes
- #[Column]
- $name: 'available'
- $type: 'boolean'
$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: 'payment_method_price_id'
- $type: 'integer'
- $options: ['unsigned' => true]
- #[GeneratedValue]
- #[Id]
$paymentMethod
protected
TPaymentMethod|null
$paymentMethod
= null
$price
protected
string
$price
= '0.000'
Attributes
- #[Column]
- $name: 'price'
- $type: 'decimal'
- $precision: 10
- $scale: 3
$tariff
protected
TShipperTariff|null
$tariff
= null
$useFreeFrom
protected
bool
$useFreeFrom
= false
Attributes
- #[Column]
- $name: 'use_free_from'
- $type: 'boolean'
Methods
__construct()
public
__construct([int|null $id = null ][, mixed $tariff = null ][, mixed $paymentMethod = null ][, int|null $currencyId = null ][, DateTime|null $dateFrom = null ][, string $price = '0.000' ][, bool $available = false ][, string|null $freeFrom = null ][, bool $useFreeFrom = false ]) : mixed
Parameters
- $id : int|null = null
- $tariff : mixed = null
- $paymentMethod : mixed = null
- $currencyId : int|null = null
- $dateFrom : DateTime|null = null
- $price : string = '0.000'
- $available : bool = false
- $freeFrom : string|null = null
- $useFreeFrom : bool = false
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>getAvailable()
public
getAvailable() : bool
Return values
boolgetCurrencyId()
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|nullgetPaymentMethod()
public
getPaymentMethod() : TPaymentMethod|null
Return values
TPaymentMethod|nullgetPrice()
public
getPrice() : string
Return values
stringgetPriceAsFloat()
public
getPriceAsFloat() : float
Return values
floatgetTariff()
public
getTariff() : TShipperTariff|null
Return values
TShipperTariff|nullgetUseFreeFrom()
public
getUseFreeFrom() : bool
Return values
boolisAvailable()
public
isAvailable() : bool
Return values
boolisPersisted()
public
isPersisted() : bool
Return values
boolisUseFreeFrom()
public
isUseFreeFrom() : bool
Return values
boolsetAvailable()
public
setAvailable(bool $available) : $this
Parameters
- $available : 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
$thissetPaymentMethod()
public
setPaymentMethod(TPaymentMethod|null $paymentMethod) : $this
Parameters
- $paymentMethod : TPaymentMethod|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
$thissetUseFreeFrom()
public
setUseFreeFrom(bool $useFreeFrom) : $this
Parameters
- $useFreeFrom : bool
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>