Doctrine 1
  1. Doctrine 1
  2. DC-720

Add primary key for count / groupby query

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Invalid
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      linux symfony 1.4.5

      Description

      with table

      Maintenance:
      columns:
      id:

      Unknown macro: { type}

      record_id:

      Unknown macro: { type}

      ,
      referenced_relation:

      Unknown macro: { type}

      people_ref:

      Unknown macro: { type}

      ,
      category:

      Unknown macro: { type}

      i'm trying to count number of maintenances by record_id

      and doctrine construct my dql correctly :

      SELECT COUNT(m.id) AS cnt, m.record_id FROM Maintenance m WHERE m.record_id IN GROUP BY m.record_id

      But after this, it translate to a wrong sql query :

      SELECT c.id AS c_id, c.record_id AS crecord_id, COUNT(c.id) AS c_0 FROM collection_maintenance c WHERE (c.record_id IN ) GROUP BY c.record_id

      And postgresql says that c.id must be in the group by... but i don't want it!

      Please help me

        Activity

        Hide
        Jonathan H. Wage added a comment -

        Hi, if you execute object record hydration it will always include the identifier. You must bypass the hydration.

        For future reference, the Jira system is for reporting bugs. You can ask questions using the mailing lists here: http://www.doctrine-project.org/community

        Show
        Jonathan H. Wage added a comment - Hi, if you execute object record hydration it will always include the identifier. You must bypass the hydration. For future reference, the Jira system is for reporting bugs. You can ask questions using the mailing lists here: http://www.doctrine-project.org/community

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Brice Maron
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: