控制器“ JMS \ TranslationBundle \ Controller \ TranslateController”具有必需的构造函数参数,并且不存在于容器中

时间:2018-09-17 12:33:03

标签: php symfony4

我将Symfony从3.3升级到4.1,JMS \ TranslationBundle停止工作。

错误是

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

我尝试导入

进口: -{资源:'@ JMSTranslationBundle / Resources / config / services.xml'}

不变

1 个答案:

答案 0 :(得分:3)

我有同样的问题。我在这里写评论:

constructor arguments and does not exist in the container

这对我有用:

添加到service.yaml:

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


JMS\TranslationBundle\Controller\ApiController:
    public: true
    arguments:
        $configFactory: '@jms_translation.config_factory'
        $updater: '@jms_translation.updater'

并评论或删除此内容:

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