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

Closed
opened 2026-01-22 13:16:32 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 12, 2011).

Originally assigned to: @beberlei on GitHub.

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 { }
Originally created by @doctrinebot on GitHub (Jun 12, 2011). Originally assigned to: @beberlei on GitHub. 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. ``` java /**** * @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 { } ```
admin added the Bug label 2026-01-22 13:16:32 +01:00
admin closed this issue 2026-01-22 13:16:34 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jun 18, 2011):

Comment created by @beberlei:

This was fixed or something.

@doctrinebot commented on GitHub (Jun 18, 2011): Comment created by @beberlei: This was fixed or something.
Author
Owner

@doctrinebot commented on GitHub (Jun 18, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jun 18, 2011): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Jun 30, 2011):

Comment created by codingrobot:

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

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 commented on GitHub (Jun 30, 2011): Comment created by codingrobot: 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.
Author
Owner

@doctrinebot commented on GitHub (Jun 30, 2011):

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 commented on GitHub (Jun 30, 2011): 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.
Author
Owner

@doctrinebot commented on GitHub (Jun 30, 2011):

Comment created by @beberlei:

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

@doctrinebot commented on GitHub (Jun 30, 2011): Comment created by @beberlei: Ok this has been changed, its not necessary for abstract classes anymore.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1513