依赖于不存在的服务"doctrine.orm.default_entity_manager"

whi*_*ear 4 symfony doctrine-orm

我正在使用JMSPaymentCoreBundle和JMSPaymentPaypalBundle.

它之前运作良好,但现在我必须更改我的config.yml for new Bundle(FOSMessageBundle)

我必须停止使用'auto_mapping'并使用'entity_managers'代替

doctrine:
    dbal:

    orm:
        auto_generate_proxy_classes: %kernel.debug%
#       auto_mapping: true
        entity_managers:
            FOSUserBundle: ~
            FOSMessageBundle: ~
Run Code Online (Sandbox Code Playgroud)

但是经过这种改变.

 The service "payment.plugin_controller" has a dependency on a non-existent service "doctrine.orm.default_entity_manager"
Run Code Online (Sandbox Code Playgroud)

发生此错误.

我认为config.yml中的更改会导致这种麻烦.

我怎么解决这个问题?

Tho*_*ire 5

根据错误,您需要定义名为的实体管理器default.在您的情况下,整体语法是错误的,请参阅我的示例.

在config.yml中:

doctrine:
    orm:
        entity_managers:
            default: # that's the name of the entity manager
                connection: default # you need to define the default connection
                mappings: 
                    FOSUserBundle: ~
                    FOSMessageBundle: ~
Run Code Online (Sandbox Code Playgroud)

我建议你阅读有关"数据库和学说""如何使用多个实体管理器和连接"的文档