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

Symfony 4 TranslateController" has required constructor arguments and does not exist in the container #498

Open
grekpg opened this issue Sep 18, 2018 · 5 comments

Comments

@grekpg
Copy link

grekpg commented Sep 18, 2018

Controller "JMS\TranslationBundle\Controller\TranslateController" has required constructor arguments and does not exist in the container. Did you forget to define such a service?

When i upgrade symfony from 3,3 to 4.1
Any solution ?

@gnat42
Copy link
Collaborator

gnat42 commented Sep 18, 2018

Just out of curiosity what happens if you make the jms_translation.loader_manager a public service by manually editing the services.xml in the bundle? Does that work? I'm also wondering how this bug is reproduced as the system passed tests on sf ^4.0.

@grekpg
Copy link
Author

grekpg commented Sep 18, 2018

i set
<service id="jms_translation.loader_manager" public="true" class="%jms_translation.loader_manager.class%" />

But any change still get error :

Too few arguments to function JMS\TranslationBundle\Controller\TranslateController::__construct(), 0 passed in /application/vendor/symfony/http-kernel/Controller/ControllerResolver.php on line 133 and exactly 2 expected

@gnat42
Copy link
Collaborator

gnat42 commented Sep 19, 2018

could you create a simple repository that reproduces this error?

@merigold
Copy link

merigold commented Sep 20, 2018

I added this in services.yaml

JMS\TranslationBundle\Controller\TranslateController:
        public: true
        arguments:
            $configFactory: '@jms_translation.config_factory'
            $loader: '@jms_translation.loader_manager'

And this:

imports:
- { resource: '@JMSTranslationBundle/Resources/config/services.xml' }

No my error look like this:
You need to configure at least one config under "jms_translation.configs".

but I have:

jms_translation:
  locales: ['pl']
  source_language: 'en' 
  configs:
    app:
      dirs: ["%kernel.root_dir%/../templates", "%kernel.root_dir%/../src"]
    .......

@merigold
Copy link

merigold commented Sep 24, 2018

this work:

https://stackoverflow.com/questions/52367845/controller-jms-translationbundle-controller-translatecontroller-has-required-c

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

3 participants