Details
-
Type:
Bug
-
Status:
Open
-
Priority:
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.