My application stores the prices of the orders like this:
id|price_total|currency|
--|-----------|--------|
1| 127.65|EUR |
2| 197.65|USD |
3| 294.95|EUR |
I need to display this within EasyAdmin 3:
# BuyOrderCrudController.php
public function configureFields(string $pageName): iterable
{
...
yield CurrencyField::new("currency");
yield MoneyField::new('price_total')
->setCurrency('EUR');
...
}
I need to fix the hardcoded EUR
in ->setCurrency('EUR')
by getting the EUR
or USD
value from the currency
field.
I cannot figure out what syntax or function to use.