DDC-2744: Inheritance - Empty value for discriminatorColumn in query #3433

Open
opened 2026-01-22 14:19:50 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Oct 16, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user dani:

Hello, I have an inheritance problem with the following classes

<?php

namespace Proj\Bundle\MyBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/****
 * ClassTop
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Proj\Bundle\MyBundle\Repository\ClassTopRepository")
 * @ORM\InheritanceType("SINGLE_TABLE")
 * @ORM\DiscriminatorColumn(name="aVal", type="string")
 * @ORM\DiscriminatorMap({ "ValOne" = "ClassSubOne", "ValTwo" = "ClassSubTwo", "ValThree" = "ClassSubThree" })
 * 
 */
class ClassTop
{
    .....
}

class ClassSubOne extends ClassTop
{
    ....
}

class ClassSubTwo extends ClassTop
{
    ....
}

class ClassSubThree extends ClassTop
{
    ....
}

When i call findAll method my query is not correct

$entityManager->getRepository('ProjMyBundle:ClassSubOne')->findAll()

the query builded

SELECT field, field2 FROM CLASSTOP WHERE AVAL IN () 

The value for the discriminator column is not passed :(

Thanks for your help

Originally created by @doctrinebot on GitHub (Oct 16, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user dani: Hello, I have an inheritance problem with the following classes ``` <?php namespace Proj\Bundle\MyBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /**** * ClassTop * * @ORM\Table() * @ORM\Entity(repositoryClass="Proj\Bundle\MyBundle\Repository\ClassTopRepository") * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="aVal", type="string") * @ORM\DiscriminatorMap({ "ValOne" = "ClassSubOne", "ValTwo" = "ClassSubTwo", "ValThree" = "ClassSubThree" }) * */ class ClassTop { ..... } class ClassSubOne extends ClassTop { .... } class ClassSubTwo extends ClassTop { .... } class ClassSubThree extends ClassTop { .... } ``` When i call findAll method my query is not correct ``` $entityManager->getRepository('ProjMyBundle:ClassSubOne')->findAll() ``` the query builded ``` SELECT field, field2 FROM CLASSTOP WHERE AVAL IN () ``` The value for the discriminator column is not passed :( Thanks for your help
admin added the Bug label 2026-01-22 14:19:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3433