FriendsOfSylius / SyliusImportExportPlugin

Sylius plugin to import / export data
MIT License
118 stars 82 forks source link

Exporter relies on deprecated `money_format()` function #260

Open mbabker opened 3 years ago

mbabker commented 3 years ago

The money_format() function is deprecated in PHP 7.4 and removed in PHP 8.0. The function is still used in FriendsOfSylius\SyliusImportExportPlugin\Exporter\Transformer\Handler\IntegerToMoneyFormatHandler::process().

oallain commented 3 years ago

Hello @mbabker

Do you think NumberFormatter::formatCurrency is the right choice ?

Isabellebengrine commented 3 years ago

I have this problem as well; I just installed the plugin and the command line works but if I click on the 'export' button on the order admin page, I get this error about the money_format... so how can I fix that please ?

Isabellebengrine commented 3 years ago

By doing this: protected function process($key, $value): ?string { $locale = ''; if(isset($GLOBALS['request']) && $GLOBALS['request']) { $locale = $GLOBALS['request']->getLocale(); } $fmt = new \NumberFormatter( $locale, \NumberFormatter::CURRENCY ); return $fmt->formatCurrency($value/100, "EUR"); }

it works now ... However, being only a beginner, I would appreciate if someone here could review this code and check if this is the right way to do it... also, what can I do to override this file in my sylius app ?

Also, is there a way to use the translations to have the column names in my locale instead of in english ? Thanks in advance!

harunbuljubasic commented 1 year ago

Any news here? I have the same problem with PHP 8.1