Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1596

Discriminator column has no table alias

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Git Master
    • Fix Version/s: 2.3
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      Some single table inheritance

      Resource.php
      /**
       * @Orm\Entity
       * @Orm\Table(name="resource")
       * @Orm\InheritanceType("SINGLE_TABLE")
       * @Orm\DiscriminatorColumn(name="type", type="string")
       * @Orm\DiscriminatorMap({"Container" = "Container", "News"="News"})
       */
      abstract class Resource
      {
      }
      
      $em->getRepository('News')->find($id)
      /**
      * generate SQL like this: 
      * SELECT t0.id AS id1, t0.name AS name2, type FROM resource t0 WHERE t0.id = ? AND t0.type IN ('News')
      */
      

      Column type has no table alias.
      I expected SQL like this:

      SELECT t0.id AS id1, t0.name AS name2, t0.type FROM resource t0 WHERE t0.id = ? AND t0.type IN ('News')
      

      Proposed patch attached

        Activity

        Show
        Guilherme Blanco added a comment - Fixed in https://github.com/doctrine/doctrine2/commit/bb1021198355871bd78b19c7795900be0020520b

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Gandzy Ghennady
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: