symfony - Doctrine2 / Symfony2 - Multiple entities on same table -
in symfony2 application have mainbundle , distinct bundles can enabled or not. in mainbundle need have model , basic entity. in otherbundle entity same table name entity in mainbundle.
fixtures in mainbundle need loaded or without other bundles mainbundle :
mainbundle - model - entity (table name "test") - fixtures otherbundle - entity (table name "test") - fixtures otherbundle2 - entity (table name="test") - fixtures
if used @orm\mappedsuperclass model, @orm\entity entity in mainbundle , @orm\entity in otherbundle doctrine2 stop error "table exists".
i cant use inheritance table model dont need know other entities in other bundles. @orm\discriminatormap cant point otherbundle.
is there way ?
as mentioned jasper n. brouwer it's esentially same entity , same table, there no point in doing you're trying do.
create entity in bundle named example "sharedentitybundle" , use resolve_target_entity relate entity other bundles without them knowing eachother.
http://symfony.com/doc/current/cookbook/doctrine/resolve_target_entity.html
that being said, there seems solution multiple entity managers: symfony 2 / doctrine 2: 2 entities same table, use 1 in favour of other
Comments
Post a Comment