Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2744

Inheritance - Empty value for discriminatorColumn in query

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      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

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Daniel Dos Prazeres
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: