DDC-1203: Single Table Inheritance - Discriminator Column is not populated #1809

Closed
doctrinebot opened this Issue Jun 12, 2011 · 5 comments

2 participants

@doctrinebot

Jira issue originally created by user johannes:

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

Comment created by @beberlei:

This was fixed or something.

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by codingrobot:

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

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.

@doctrinebot

Comment created by @beberlei:

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

@doctrinebot

Comment created by @beberlei:

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

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added this to the 2.1 milestone Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment