2012-08-02 47 views
2

我剛剛開始使用Symfony2,目前正嘗試從現有數據庫生成Doctrine實體。我正在關注official tutorial on the topic,但是,我想讓我的實體在默認(MyVendor\MyBundle\Model\Entity而不是MyVendor\MyBundle\Entity)之外的其他名稱空間中生成。Symfony 2 - 學說:映射:導入到自定義命名空間

我編輯的config.yml文件是這樣的:

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

不幸的是,我不能得到這個工作,因爲實體在默認命名空間和目錄仍產生。我究竟做錯了什麼?如下

回答

0

更改上面的代碼:請auto_mapping真的......

ORM: auto_generate_proxy_classes:%kernel.debug% default_entity_manager:默認

entity_managers: 
     default: 
      auto_mapping: true 
      mappings: ~ 

試試這個..希望這會爲工作您。