[DDC-1203] Single Table Inheritance - Discriminator Column is not populated Created: 12/Jun/11  Updated: 30/Jun/11  Resolved: 18/Jun/11

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: Git Master
Fix Version/s: 2.1
Security Level: All

Type: Bug Priority: Critical
Reporter: Johannes Schmitt Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None

Attachments: JPEG File graph.jpg    


I have the following class inheritance; if I have the mapped super class in there, the discriminator column is not populated; if I remove it, it is correctly set.

 * @ORM\Entity
 * @ORM\Table(name = "a")
 * @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
 * @ORM\InheritanceType("SINGLE_TABLE")
 * @ORM\DiscriminatorColumn(name="type", type="string", length=20)
 * @ORM\DiscriminatorMap({
 *     "c"   = "C",
 *     "d"   = "D"
 * })
abstract class A { }

 * @ORM\MappedSuperClass
abstract class B extends A { }

 * @ORM\Entity
class C extends B { }

 * @ORM\Entity
class D extends B { }

Comment by Benjamin Eberlei [ 18/Jun/11 ]

This was fixed or something.

Comment by Nikolai Spassoff [ 30/Jun/11 ]

The following hierarchy doesn't work after commit 5ff44b5ec75f6d716ec3.

The thrown exception is:
'Entity\AbstractMaschine' has to be part of the descriminator map of 'Entity\Inventory'

Inventory is just a plain abstract class which contains the @Id field and a few methods used by all subclasses.

Comment by Benjamin Eberlei [ 30/Jun/11 ]

Yes, please add it to the discriminator map, it is necessary for internal algorithms that this class is in the map.

Comment by Benjamin Eberlei [ 30/Jun/11 ]

Ok this has been changed, its not necessary for abstract classes anymore.

Generated at Fri Oct 09 02:52:41 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.