我最初发布这个问题在这里:https://github.com/doctrine/DoctrineBundle/issues/297主义类表继承和财产ignoral
我有以下实体层次,myProduct的被父实体通过类表继承映射:
SyliusProduct # Mapped superclass containing the 'options' association mapping
–- MyProduct # Mapped superclass that should override the association (Head of CTI)
---- MyProduct1 # Ultimate children (entities)
---- MyProduct2
---- MyProduct3
---- MyProduct4
SyliusProduct与选项实体具有多对多关联,该实体映射在SyliusProduct的映射中。
我无法更改SyliusProduct(它是Symfony供应商的一部分)的映射。
当生成模式时,学说要为每个最终子代生成sylius_product_options表,该表抛出'tables exists'异常。
有没有办法要么:
- 通过创建4个不同的 表映射在最终子级别的关系(和指定不同的表名)?
- 映射它在MyProduct级别?
- 干脆忽略这种关联?
您是否为每个产品创建新实体? – qooplmao
是的,MyProduct [1,2,3,4]是扩展MyProduct的实体。 – Christian
您的问题是'产品'实体/表应该包含您的所有产品在同一个实体/表中,而不是每个产品。 – qooplmao