Doctrine Website
  1. Doctrine Website
  2. DWEB-64

wrong resulting sql in Aggregate values

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Component/s: Documentation
    • Labels:
      None

      Description

      the Aggregate values in the DQL documentation

      the following code
      $q = Doctrine_Query::create()
      ->select('u.id, COUNT(t.id) AS num_threads')
      ->from('User u, u.Threads t')
      ->where('u.id = ?', 1)
      ->groupBy('u.id');

      echo $q->getSqlQuery();

      the documentation says it will result in the following query
      SELECT
      u.id AS u__id,
      COUNT(f.id) AS f__0
      FROM user u
      LEFT JOIN forum__thread f ON u.id = f.user_id
      WHERE u.id = ?
      GROUP BY u.id

      notice the different, in DQL we are aggregating users with threads, but the resulting sql joins forums not threads.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Ahmed Ali
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: