How do I change symfony 2 doctrine mapper to use my custom directory instead of my Entity Directory under the bundle

后端 未结 3 519
甜味超标
甜味超标 2021-01-05 02:29

I use doctrine in my symfony 2.3 application. I want to use a folder structure like

/MyBundleName/User/User.php

for my Entities.

3条回答
  •  失恋的感觉
    2021-01-05 03:29

    I've spent some time trying to figure out the simplest case. This is how I made it work:

    doctrine:
        orm:
            auto_generate_proxy_classes: "%kernel.debug%"
            auto_mapping: true
            mappings:
                AppBundle:
                    mapping: true
                    type: annotation
                    dir: Model
                    alias: AppBundle
                    prefix: 'AppBundle\Model'
                    is_bundle: true
    

    I simply wanted to store my entities in a directory called 'Model' inside my bundle, instead of the default 'Entity'.

提交回复
热议问题