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

标签 symfony doctrine-orm

我正在使用 JMSPaymentCoreBundle 和 JMSPaymentPaypalBundle。

它以前运行良好,但现在我必须为新的 Bundle(FOSMessageBundle) 更改我的 config.yml

我必须停止使用“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"

关于symfony - 依赖不存在的服务 "doctrine.orm.default_entity_manager",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18816973/

相关文章:

symfony - 选择没有子项的实体

php - Symfony2 和其他 MVC 框架中的模型?

php - Symfony2 - Doctrine - 有没有办法在一行中保存实体?

php - Symfony 4/doctrine 插入初始数据库数据

mysql - mysql中的DC2Type数组数据类型是什么

Symfony 2 覆盖实体并添加额外属性

php - 将变量传递给 Symfony2 中的 Assetic Assets URL

php - 如何在doctrine/php中的实体属性中聚合来自不同表的信息?

php - 使用数组的 Doctrine 查询生成器

php - Symfony2+Doctrine2 : How to properly localize records?