Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
doctrinebot opened this issue Jun 12, 2011 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@doctrinebot
Copy link

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
Copy link
Author

Comment created by @beberlei:

This was fixed or something.

@doctrinebot
Copy link
Author

Issue was closed with resolution "Fixed"

@doctrinebot
Copy link
Author

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
Copy link
Author

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
Copy link
Author

Comment created by @beberlei:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants