2

I'm just getting started with Symfony2, currently trying to generate Doctrine entities from an existing database. I'm following the official tutorial on the topic, however, I'd like to have my entities generated in a different namespace other than the default (MyVendor\MyBundle\Model\Entity instead of MyVendor\MyBundle\Entity).

I've edited the config.yml file like this:

doctrine:
   orm:
     entity_managers:
       default:
         mappings:
           MyBundle:
             prefix: MyVendor\MyBundle\Model\Entity
             dir: Model/Entity

Unfortunately, I can't get this to work, as entities are still generated in the default namespace and directory. What am I doing wrong?

4

1 回答 1

0

将上面的代码更改如下:使 auto_mapping true...

orm: auto_generate_proxy_classes: %kernel.debug% default_entity_manager: 默认

    entity_managers:
        default:
            auto_mapping: true
            mappings: ~ 

试试这个..希望这对你有用。

于 2013-10-01T14:55:12.043 回答