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

ImportTranslationsCommand: undefined method named "getFormats" #451

Open
nicodemuz opened this issue Jan 11, 2024 · 3 comments
Open

ImportTranslationsCommand: undefined method named "getFormats" #451

nicodemuz opened this issue Jan 11, 2024 · 3 comments

Comments

@nicodemuz
Copy link

Using Symfony 6.4:

*** Importing application translation files ***
*** Using dir /path/to/symfony/translations to lookup translation files. ***
07:36:31 CRITICAL  [console] Error thrown while running command "--env=prod lexik:translations:import --cache-clear --locales=en --domains='app,email,validators'". Message: "Call to undefined method Symfony\Bundle\FrameworkBundle\Translation\Translator::getFormats()" ["exception" => Error { …},"command" => "--env=prod lexik:translations:import --cache-clear --locales=en --domains='app,email,validators'","message" => "Call to undefined method Symfony\Bundle\FrameworkBundle\Translation\Translator::getFormats()"]

In ImportTranslationsCommand.php line 334:
                                                                               
  Attempted to call an undefined method named "getFormats" of class "Symfony\Bundle\FrameworkBundle\Translation\Translator".
                                                                               

lexik:translations:import [-c|--cache-clear] [-f|--force] [-g|--globals] [-l|--locales LOCALES] [-d|--domains [DOMAINS]] [-i|--case-insensitive] [-m|--merge] [-p|--import-path IMPORT-PATH] [-o|--only-vendors] [--] [<bundle>]
@bartmcleod
Copy link
Collaborator

@nicodemuz Use dev-6.0 in composer

@bartmcleod
Copy link
Collaborator

But I doubt if that will fix it, as the new SF 7 changes are not yet in master anyway, as far as I know, so they can not have broken your installation. What if an update to the translation bundle caused this and you need to pin it on an earlier release @nicodemuz ?

@nicodemuz
Copy link
Author

It seems to happen only if LexikTranslationBundle is loaded before FrameworkBundle in bundles.php:

    Lexik\Bundle\TranslationBundle\LexikTranslationBundle::class => ['all' => true],
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],

Swapping the order seems to fix the issue.

I had originally swapped the order of bundles in bundles.php because of this issue: #440

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

No branches or pull requests

2 participants