Details
Description
I have an abstract PHP class 'PartyAbstract' that uses Single Table Inheritance with a discriminator map to distinguish between a number of classes that extend the 'PartyAbstract' class. The 'PartyAbstract' class itself is not an entry in that discriminator map. Annotations are used to define the discriminator map.
/** * @Entity * @Table(schema="public", name="party") * @InheritanceType("JOINED") * @DiscriminatorColumn(name="discriminator", type="integer") * @DiscriminatorMap({ * "1" = "Project\Entity\Party\PartyType1", * "2" = "Project\Entity\Party\PartyType2", * "3" = "Project\Entity\Party\PartyType3" * }) abstract class PartyAbstract{}
As of version 2.1.0-rc1, the following exception is thrown:
"Entity 'Project\Entity\PartyAbstract' has to be part of the descriminator map of 'Project\Entity\PartyAbstract' to be properly mapped in the inheritance hierachy. If you want to avoid instantiation of this type mark it abstract."
My question is: how can I mark this Entity abstract? I DO want to be able to count the complete number of Parties, but instantiation of the PartyAbstract class is never required. The use of @MappedSuperclass is not allowed here, or together with the @Entity annotation...
PS: also not that the message in the exception contains two typo's
- 'descriminator' vs 'discriminator'
- 'hierachy' vs 'hierarchy'
This way: