Skip to content

Loading…

DDC-1529: Multiple FROM Entities and inheritance #2161

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user lutangar:

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

when try a simple :
{quote}
$query = $this->_em->createQuery('
SELECT a, p
FROM SG\CmsBundle\Entity\Article a, SG\ProgramBundle\Entity\Program p');
$query->getResult();
{quote}

The generated sql is :
{quote}
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'))
{quote}

The only problem is, we got an extra AND at the end of the query, the query should look smthin like this :
{quote}
SELECT ... WHERE (s0.kind IN ('Article') AND s1.kind IN ('Program'))
{quote}

@doctrinebot

Comment created by @guilhermeblanco:

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: febfe35

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.3 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.