PriceRecalculator
in package
Self-heals the denormalized `product_sets.price` listing sort column from the `current_prices` view.
One set-based UPDATE, no N+1: activates newly valid planned prices into the sort column
and repairs drift the beforeSave hot path could not see (partial saves, other-group edits).
The sort price is the current price for the base user group and default currency at the
base quantity tier (from_amount <= 1, highest such tier). Sets without a matching price
get 0 (sorted last). Positional params (value repeated) avoid the named-param-reuse gotcha.
The base group and currency ids are not read here (a service must not touch foreign System tables): the caller ProductSetManager::recountPrices() reads them and passes them as parameters.
Table of Contents
Constants
- SETS_TABLE : string = 'cms_mod_eshop_product_sets'
- VIEW : string = 'cms_mod_eshop_product_set_current_prices'
Properties
- $em : EntityManagerInterface
Methods
- __construct() : mixed
- recalcSortPrices() : int
Constants
SETS_TABLE
private
string
SETS_TABLE
= 'cms_mod_eshop_product_sets'
VIEW
private
string
VIEW
= 'cms_mod_eshop_product_set_current_prices'
Properties
$em read-only
private
EntityManagerInterface
$em
Methods
__construct()
public
__construct(EntityManagerInterface $em) : mixed
Parameters
- $em : EntityManagerInterface
recalcSortPrices()
public
recalcSortPrices(int $groupId, int $currencyId) : int
Parameters
- $groupId : int
- $currencyId : int
Return values
int —number of ProductSet rows whose sort price row was touched by the UPDATE