Метод withMoneyFieldNumberFormatFetchModifier

public

Сигнатура метода

public function withMoneyFieldNumberFormatFetchModifier(FloatField $field, ScalarField $currencyField): FloatField

Возвращает: FloatField

Описание

Currency-aware analogue of {@see withNumberFormatFetchModifier()} for money fields. Attaches a fetch-data modifier to $field that, for every row returned by an ORM query: - passes null/empty value through unchanged; - reads the currency code from the same row by the name of $currencyField, resolves DECIMALS via {@see Currency::getCurrencyDecimals()} and returns the value formatted with that precision via {@see number_format()}; - falls back to {@see Accounting::getPricePublicPrecision()} when DECIMALS could not be resolved (the currency column is not in the SELECT, its value is empty, the currency module is unavailable, or the resolved decimals value is empty). The returned value is a string (from number_format) for every non-null/non-empty input. Only the name of $currencyField is consumed (via ->getName()); the instance itself is not retained or registered. The currency column with the same name must be present in the SELECT of the same query for the modifier to read it from a row. The modifier is appended to the field's modifier chain (does not replace pre-existing modifiers).

Параметры

2
Имя Тип По умолчанию Флаги
$field FloatField —
—
$currencyField ScalarField —
—

Расположение

Исходный файл метода в Bitrix Framework

Путь к исходному файлу Source
~/bitrix/modulescrm/lib/Model/FieldRepository.php
Расположение метода в файле
Строки 1081–1095

Исходный код

PHP