Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1529

Multiple FROM Entities and inheritance

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.2
    • Fix Version/s: 2.3
    • Component/s: DQL, ORM
    • Security Level: All
    • Labels:
      None
    • Environment:
      Symfony 2

      Description

      I got a single table inheritance on an object Content (Program, Article, etc...)

      when try a simple :

      $query = $this->_em->createQuery('
      SELECT a, p
      FROM SG\CmsBundle\Entity\Article a, SG\ProgramBundle\Entity\Program p');
      $query->getResult();

      The generated sql is :

      SELECT s0_.id AS id0, s0_.title AS title1, s0_.description AS description2, s0_.tags AS tags3, s0_.keywords AS keywords4, s0_.robots AS robots5, s0_.author_name AS author_name6, s0_.fb_description AS fb_description7, s0_.type AS type8, s0_.is_active AS is_active9, s0_.is_deleted AS is_deleted10, s0_.is_published AS is_published11, s0_.published_at AS published_at12, s0_.unpublished_at AS unpublished_at13, s0_.slug AS slug14, s0_.created_at AS created_at15, s0_.updated_at AS updated_at16, s0_.lft AS lft17, s0_.rgt AS rgt18, s0_.root AS root19, s0_.lvl AS lvl20, s1_.id AS id21, s1_.title AS title22, s1_.description AS description23, s1_.tags AS tags24, s1_.keywords AS keywords25, s1_.robots AS robots26, s1_.author_name AS author_name27, s1_.fb_description AS fb_description28, s1_.type AS type29, s1_.is_active AS is_active30, s1_.is_deleted AS is_deleted31, s1_.is_published AS is_published32, s1_.published_at AS published_at33, s1_.unpublished_at AS unpublished_at34, s1_.slug AS slug35, s1_.created_at AS created_at36, s1_.updated_at AS updated_at37, s1_.lft AS lft38, s1_.rgt AS rgt39, s1_.root AS root40, s1_.lvl AS lvl41, s0_.kind AS kind42, s0_.parent_id AS parent_id43, s0_.template_article_id AS template_article_id44, s0_.template_page_id AS template_page_id45, s0_.author_id AS author_id46, s1_.kind AS kind47, s1_.parent_id AS parent_id48, s1_.template_article_id AS template_article_id49, s1_.template_page_id AS template_page_id50, s1_.author_id AS author_id51 FROM sg_content s0_, sg_content s1_ WHERE (s0_.kind IN ('Article') AND AND s1_.kind IN ('Program'))

      The only problem is, we got an extra AND at the end of the query, the query should look smthin like this :

      SELECT ... WHERE (s0_.kind IN ('Article') AND s1_.kind IN ('Program'))

        Activity

        Hide
        Guilherme Blanco added a comment -

        Invalid for 2.2. I couldn't track the exact commit this was fixed, so I'll keep fix version for 2.3.
        Coverage commit reference: https://github.com/doctrine/doctrine2/commit/febfe35c2315a20534630aa9e5b9c72a0047f569

        Show
        Guilherme Blanco added a comment - Invalid for 2.2. I couldn't track the exact commit this was fixed, so I'll keep fix version for 2.3. Coverage commit reference: https://github.com/doctrine/doctrine2/commit/febfe35c2315a20534630aa9e5b9c72a0047f569

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Johan Dufour
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: