Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporter relies on deprecated money_format() function #260

Open
mbabker opened this issue Apr 20, 2021 · 4 comments
Open

Exporter relies on deprecated money_format() function #260

mbabker opened this issue Apr 20, 2021 · 4 comments

Comments

@mbabker
Copy link
Contributor

mbabker commented Apr 20, 2021

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
Copy link
Member

oallain commented Apr 23, 2021

Hello @mbabker

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

@Isabellebengrine
Copy link

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
Copy link

Isabellebengrine commented Sep 2, 2021

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants