DDC-3724: Resolve target entity also in discriminator map: does not work with non-alphabetical order #4571

Open
opened 2026-01-22 14:45:03 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (May 4, 2015).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user Alan Poulain:

Using a discriminator map and interfaces lead to an exception when there are not in alphabetical order.
For example,

/****
 * @ORM\DiscriminatorMap({
 *     "a" = "AEntityInterface",
 *     "b" = "BEntityInterface"
 * })
 */

is working but,

/****
 * @ORM\DiscriminatorMap({
 *     "b" = "BEntityInterface",
 *     "a" = "AEntityInterface"
 * })
 */

lead to:
{quote}
[Doctrine\Common\Persistence\Mapping\MappingException]
Class 'BEntityInterface' does not exist
{quote}

Originally created by @doctrinebot on GitHub (May 4, 2015). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user Alan Poulain: Using a discriminator map and interfaces lead to an exception when there are not in alphabetical order. For example, ``` /**** * @ORM\DiscriminatorMap({ * "a" = "AEntityInterface", * "b" = "BEntityInterface" * }) */ ``` is working but, ``` /**** * @ORM\DiscriminatorMap({ * "b" = "BEntityInterface", * "a" = "AEntityInterface" * }) */ ``` lead to: {quote} [Doctrine\Common\Persistence\Mapping\MappingException] Class 'BEntityInterface' does not exist {quote}
admin added the Bug label 2026-01-22 14:45:03 +01:00
Author
Owner

@mpdude commented on GitHub (Dec 21, 2020):

Could you double-check that there is no autoloading issue involved?

In particular, make sure you don't have both interfaces AEntityInterface and BEntityInterface in a file called AEntityInterface.php.

@mpdude commented on GitHub (Dec 21, 2020): Could you double-check that there is no autoloading issue involved? In particular, make sure you don't have both interfaces `AEntityInterface` and `BEntityInterface` in a file called `AEntityInterface.php`.
Author
Owner

@mpdude commented on GitHub (Dec 21, 2020):

@alanpoulain was that your original issue?

@mpdude commented on GitHub (Dec 21, 2020): @alanpoulain was that your original issue?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4571