Sylius: Wrong interface given for FlashHelper

Created on 13 Nov 2016  路  2Comments  路  Source: Sylius/Sylius

After installation I got an error:
Sylius\Bundle\ResourceBundle\Controller\FlashHelper::__construct() must be an instance of Symfony\Component\Translation\TranslatorBagInterface, instance of Symfony\Component\Translation\IdentityTranslator given

I've to override service like this:
translator: class: "%translator.class%" arguments: - "@service_container" - "@translator.selector" - [] - { cache_dir: "%kernel.cache_dir%/translations", debug: "%kernel.debug%" } calls: - [setConfigCacheFactory, ['@config_cache_factory']]

Most helpful comment

Just installed sylius/sylius and sylius/sylius-standard and in both cases FlashHelper works.
My guess is something went wrong with your config file.

Please check if you have the default sylius config.yml, the part concerning translation should look something like:

framework:
    translator: { fallbacks: ["%locale%"] }

And if you'd prefer not having fallbacks go:

framework:
    translator: { enabled: true }

or:

framework:
    translator:
        enabled: true

Whichever of those will overwrite the translator service id with the symfony's default translator, and the flash helper will work anew.

All 2 comments

Just installed sylius/sylius and sylius/sylius-standard and in both cases FlashHelper works.
My guess is something went wrong with your config file.

Please check if you have the default sylius config.yml, the part concerning translation should look something like:

framework:
    translator: { fallbacks: ["%locale%"] }

And if you'd prefer not having fallbacks go:

framework:
    translator: { enabled: true }

or:

framework:
    translator:
        enabled: true

Whichever of those will overwrite the translator service id with the symfony's default translator, and the flash helper will work anew.

@NeverResponse, thanks, it helps. I was blind enough to miss that framework: translator was commented out

Was this page helpful?
0 / 5 - 0 ratings

Related issues

inssein picture inssein  路  3Comments

xleliberty picture xleliberty  路  3Comments

ping86 picture ping86  路  3Comments

inssein picture inssein  路  3Comments

bnd170 picture bnd170  路  3Comments