小编Thi*_*aut的帖子

Doctrine2/Symfony2 - 同一个表上的多个实体

在Symfony2应用程序中,我有一个MainBundle和不同的包,可以启用或不启用.在MainBundle中,我需要拥有模型和基本实体.在OtherBundle实体具有比相同的表名实体MainBundle.

MainBundle中的夹具需要加载或不加载MainBundle以外的其他捆绑:

MainBundle
- Model 
- Entity (Table name "test")
- Fixtures 

OtherBundle
- Entity (Table name "test")
- Fixtures

OtherBundle2
- Entity (Table name="test")
- Fixtures
Run Code Online (Sandbox Code Playgroud)

如果我使用的@ORM\MappedSuperclass模型,一个@ORM \实体实体MainBundle@ORM \实体OtherBundle然后Doctrine2停止与错误"表已经存在".

我不能使用继承表,因为我的模型不需要知道其他包中的其他实体.该@ORM\DiscriminatorMap着点OtherBundle.

有没有办法做到这一点 ?

multiple-inheritance mappedsuperclass symfony doctrine-orm

9
推荐指数
1
解决办法
6333
查看次数