Doctrine Pager and Group By
I'm having an issue with Doctrine's pager when the original query has a GROUP BY. The pager will generate this query:
SELECT COUNT(*) AS num_results FROM event e GROUP BY e.type
which is not correct as the original query should be encapsulated in parenthesis. It should be:
SELECT COUNT(开发者_如何学C*) FROM (SELECT * AS num_results FROM event e GROUP BY e.type)
Do you have any suggestions on how to go around this?
Try this:
$table->setAttribute(Doctrine_Core::ATTR_QUERY_LIMIT, Doctrine_Core::LIMIT_ROWS);
http://www.doctrine-project.org/projects/orm/1.2/docs/manual/dql-doctrine-query-language/en
精彩评论