Symfony 学说 auto_mapping 无法识别 [英] Symfony doctrine auto_mapping Unrecognized

查看:28
本文介绍了Symfony 学说 auto_mapping 无法识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了 SonataUserBundle,但出现错误

I have added SonataUserBundle and it is giving error

config.yml

doctrine: 
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true

        entity_managers:
            default:
                mappings:
                    ApplicationSonataUserBundle: ~
                    SonataUserBundle: ~

错误

无法识别的选项naming_strategy、auto_mapping、dql"下"doctrine.orm"

Unrecognized options "naming_strategy, auto_mapping, dql" under "doctrine.orm"

推荐答案

您正在混合缩短配置和完整配置.

You are mixing shortened and full configuration.

如果您只想使用默认实体管理器,那么您可以将所有内容放在 orm 键下(缩短的配置).这将被重新映射,以便它在包扩展的 doctrine.orm.entity_managers.default 下.

If you just want to use the default entity manager then you can place everything under the orm key (the shortened config). This will be remapped so that it is under doctrine.orm.entity_managers.default by the bundle extension.

但是,如果您想更改实体管理器的名称或使用多个名称,则需要使用指定每个实体管理器的完整配置.

If, however, you want to chaneg the name of the entity manager or use multiples then you would need to use the full configuration specifying each entity manager.

缩短配置

doctrine: 
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true
        mappings:
            ApplicationSonataUserBundle: ~
            SonataUserBundle: ~

完整配置

doctrine: 
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        entity_managers:
            default:
                naming_strategy: doctrine.orm.naming_strategy.underscore
                auto_mapping: true
                mappings:
                    ApplicationSonataUserBundle: ~
                    SonataUserBundle: ~

这篇关于Symfony 学说 auto_mapping 无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆