Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
690 views
in Technique[技术] by (71.8m points)

php - Symfony doctrine auto_mapping Unrecognized

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: ~

error

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You are mixing shortened and full configuration.

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.

Shortened Config

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

Full Config

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...