Doctrine 1
  1. Doctrine 1
  2. DC-608

Limit and Offset breaks query with multiple non-join FROM statements

    Details

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

      Description

      $query = $query->select('sf_guard_permission.id,
      cms_section_translation.slug||\' \'||SUBSTRING("name", POSITION(\'@\' in "name") + 1) as name,
      sf_guard_permission.description,
      sf_guard_permission.created_at, sf_guard_permission.updated_at');
      $query = $query->from('sfGuardPermission sf_guard_permission');
      $query = $query->addfrom('CmsSection cms_section');
      $query = $query->innerJoin('cms_section.WithCmsSectionTranslation cms_section_translation');
      $query = $query->where('cast(SUBSTRING("name", 1, POSITION(\'@\' in "name") - 1) as integer) = cms_section.id');
      $query = limit(20);
      $query = offset(1);

      Generated:

      SELECT s.id AS s_id, s.description AS sdescription, s.created_at AS screated_at, s.updated_at AS supdated_at, c2.slug||' '||SUBSTR("name", POSITION('@' in "name") + 1) AS c2_0 FROM sf_guard_permission s, cms_section c INNER JOIN cms_section_translation c2 ON c.id = c2.sec_id WHERE s.id IN (SELECT doctrine_subquery_alias.id FROM (SELECT DISTINCT s2.id, c3.deleted_at FROM sf_guard_permission s2 cms_section c3 INNER JOIN cms_section_translation c4 ON c3.id = c4.sec_id WHERE cast(SUBSTR("name", 1, POSITION('@' in "name") - 1) as integer) = c3.id ORDER BY c3.deleted_at DESC LIMIT 20) AS doctrine_subquery_alias) AND (cast(SUBSTR("name", 1, POSITION('@' in "name") - 1) as integer) = c.id) ORDER BY c.deleted_at DESC

      Notice:
      SELECT DISTINCT s2.id, c3.deleted_at FROM sf_guard_permission s2 comma that is missing cms_section c3

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Sid GBF
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: