douchuntang2827 2012-04-18 15:22
浏览 51
已采纳

Symfony2 / Doctrine2:生成捆绑包外的实体

I'm trying to generate entities for my Symfony 2application. The entities will be shared by several bundles (and maybe several applications), and thus I do not want them to belong to a bundle. I want them to be in the src/MyApp/Entity folder.

I already have the YML for my entities, stored in src/MyApp/Entity/config/doctrine (class1.orm.yml, ...)

I'm trying to generate the corresonding PHP classes using the doctrine:generate:entities task

Here is what I have in my app/config/config.yml

orm:
    auto_generate_proxy_classes: %kernel.debug%
    auto_mapping: false
    mappings: 
      AppRest: 
        type: yml 
        prefix: AppRest\Entity 
        dir: %kernel.root_dir%/../src/AppRest/Entity/config/doctrine

Here is the command I use to generate the entities

php app/console doctrine:generate:entities AppRest/Entity

Here is the exception I get

[InvalidArgumentException]
Bundle "AppRest" does not exist or it is not enabled.

I want to make doctrine understand that I'm not trying to generate entities tha are in a bundle. I also tried specifying the --path option (--path=src/AppRest/Entity), but it did not change anything.

Can anyone help ?

Edit:

I removed the extra space in my dir, which solved the problem. The path option must be specified

  • 写回答

3条回答 默认 最新

  • douju1953 2012-04-19 07:31
    关注

    Actually, I was just missing a space in my dir option above. This works now, but I'm still wondering whether that's the best way to go.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题