Reputation: 566
Is there a way I can extend a symfony entity in another bundle using @DiscriminatorMap
without having to specify it beforehand?
BundleA
AbstractQueueItem
which is a MappedSuperclass
for Event
which is extended by CreateEvent
and DeleteEvent
as Single Table Inheritene
or Class Table Inheritence
BundleB
UpdateEvent
) to the Event
-hierarchy without modifing BundleA
?Upvotes: 0
Views: 176
Reputation: 10877
You can try letting doctrine auto-generate the discriminator map.
From the last bullet point in this section of the docs:
If no discriminator map is provided, then the map is generated automatically. The automatically generated discriminator map contains the lowercase short name of each class as key. So you would:
@DiscriminatorMap
declaration in BundleA.EDIT
As pointed out by ju_ in the comments, this solution will apparently not work with Doctrine ORM 3.0, but should still be valid for versions 2.5 - 2.7
Upvotes: 1