CodeExplorer mapToCurrencyIso example
public function serialize(Config
$config, Field
$entity,
$prices): iterable
{ if (!
$prices) { return;
} $isoPrices =
[];
foreach ($prices as $price) { $price =
$price instanceof Struct ?
$price->
jsonSerialize() :
$price;
$currencyId =
$price['currencyId'
];
$currency =
$this->
mapToCurrencyIso($currencyId);
if (isset($price['listPrice'
]) &&
$price['listPrice'
] instanceof Struct
) { $price['listPrice'
] =
$price['listPrice'
]->
jsonSerialize();
} $isoPrices[$currency] =
$price;
if ($currencyId === Defaults::CURRENCY
) { $isoPrices['DEFAULT'
] =
$isoPrices[$currency];
} }