schmittjoh / JMSTranslationBundle

Puts the Symfony2 Translation Component on steroids
http://jmsyst.com/bundles/JMSTranslationBundle
426 stars 292 forks source link

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

Open grekpg opened 6 years ago

grekpg commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

could you create a simple repository that reproduces this error?

merigold commented 6 years ago

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 commented 6 years ago

this work:

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