[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    

 Description   

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 { }


 Comments   
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 Sat Oct 25 12:49:57 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.