symfony – 对不存在的服务的依赖“doctrine.orm.default_entity_manager”

我正在使用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: ~

但是经过这种改变.

The service "payment.plugin_controller" has a dependency on a non-existent service "doctrine.orm.default_entity_manager"

发生此错误.

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

我怎么解决这个问题?

解决方法

根据错误,您需要定义名为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: ~

我建议你阅读有关“Databases and Doctrine”“How to work with Multiple Entity Managers and Connections”文件

相关文章

迭代器模式(Iterator)迭代器模式(Iterator)[Cursor]意图...
高性能IO模型浅析服务器端编程经常需要构造高性能的IO模型,...
策略模式(Strategy)策略模式(Strategy)[Policy]意图:定...
访问者模式(Visitor)访问者模式(Visitor)意图:表示一个...
命令模式(Command)命令模式(Command)[Action/Transactio...
生成器模式(Builder)生成器模式(Builder)意图:将一个对...