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

Open
opened 2026-01-22 15:46:51 +01:00 by admin · 0 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_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7201