CoolCMS API

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
requires

AdvertManager – expects:

  • $em (EntityManagerInterface)

Table of Contents

Methods

advertCurrencyRefused()  : Result
guardAdvertPriceCurrency()  : Result|null

Methods

On this page

Search results