Mapping Exception: Entity has to be part of discriminator map - but IS #7204

Closed
opened 2026-01-22 15:46:54 +01:00 by admin · 2 comments
Owner

Originally created by @fpolli on GitHub (Aug 5, 2023).

I just today got this error and cannot get past it. The entity it tells me has to be part of the discriminator map of the root entity IS part of the discriminator map.

Here is the inheriting class definition:

namespace App\Entities\Default;

use Doctrine\ORM\Mapping as ORM;
use Exception;

#[ORM\Entity]
class Text extends Content {

And here is the Content class:


namespace App\Entities\Default;

#[ORM\Entity]
#[ORM\Table(name: "content")]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'genre', type: 'string')]
#[ORM\DiscriminatorMap([
  'text' => Text::class,


This has all been this way for weeks. No problem. I have not changed anything even remotely close to relevant. I updated my class map (Composer), cleared caches, cleared browser cache and cookies, and nothing has helped.

Originally posted by @fpolli in https://github.com/doctrine/orm/discussions/10882

Originally created by @fpolli on GitHub (Aug 5, 2023). I just today got this error and cannot get past it. The entity it tells me has to be part of the discriminator map of the root entity IS part of the discriminator map. Here is the inheriting class definition: ``` namespace App\Entities\Default; use Doctrine\ORM\Mapping as ORM; use Exception; #[ORM\Entity] class Text extends Content { ``` And here is the Content class: ``` namespace App\Entities\Default; #[ORM\Entity] #[ORM\Table(name: "content")] #[ORM\InheritanceType('SINGLE_TABLE')] #[ORM\DiscriminatorColumn(name: 'genre', type: 'string')] #[ORM\DiscriminatorMap([ 'text' => Text::class, ``` This has all been this way for weeks. No problem. I have not changed anything even remotely close to relevant. I updated my class map (Composer), cleared caches, cleared browser cache and cookies, and nothing has helped. _Originally posted by @fpolli in https://github.com/doctrine/orm/discussions/10882_
admin closed this issue 2026-01-22 15:46:54 +01:00
Author
Owner

@fpolli commented on GitHub (Aug 5, 2023):

Found the error. A global search and replace had messed up the discriminator map

@fpolli commented on GitHub (Aug 5, 2023): Found the error. A global search and replace had messed up the discriminator map
Author
Owner

@mpdude commented on GitHub (Aug 9, 2023):

@fpolli so, could you please close this issue?

@mpdude commented on GitHub (Aug 9, 2023): @fpolli so, could you please close this issue?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7204