AdvertCurrencyGuardTrait
Guards the price currency of an advert (Bazaar and Comcat) in the Api layer.
The value of a ParameterType::SELECT_CURRENCY parameter must be a public (internal = 0)
monetary (monetary = 1) currency. Forms offer only such currencies, but Api writes also come
from outside them (external client, forged POST), and credits make no sense as a price currency
even when an admin unchecks them as internal.
The guard deliberately ignores whether the currency is active: a deactivated currency on an old
advert must not break its editing. The currency is read with raw DBAL because find() would
detach the merged object graph through GetAllTrait::clearDoctrine() (see AdvertManager::beforeSave()).
Tags
Table of Contents
Methods
Methods
advertCurrencyRefused()
private
advertCurrencyRefused(string $value) : Result
Parameters
- $value : string
Return values
ResultguardAdvertPriceCurrency()
private
guardAdvertPriceCurrency(object $advert) : Result|null
Parameters
- $advert : object