CodeExplorer getCurrencyIdFromIso example
public function deserialize(Config
$config, Field
$field,
$record): ?array
{ $prices =
[];
if (!\
is_array($record)) { return null;
} foreach ($record as $currencyIso =>
$price) { $currency =
$this->
getCurrencyIdFromIso($currencyIso);
if ($currency === null || !
$this->
isValidPrice($price)) { continue;
} $listPrice = null;
if (isset($price['listPrice'
]) &&
$this->
isValidPrice($price['listPrice'
])) { $listPrice =
new Price($currency,
(float) $price['listPrice'
]['net'
],
(float) $price['listPrice'
]['gross'
],
(bool) ($price['listPrice'
]['linked'
] ?? false
));
} $priceStruct =
new Price($currency,
(float) $price['net'
],
(float) $price['gross'
],
(bool) ($price['linked'
] ?? false
),
$listPrice);