当原始查询有 GROUP BY 时,我遇到了 Doctrine 寻呼机的问题。寻呼机将生成此查询:
SELECT COUNT(*) AS num_results FROM event e GROUP BY e.type
这是不正确的,因为原始查询应该封装在括号中。应该是:
SELECT COUNT(*) FROM (SELECT * AS num_results FROM event e GROUP BY e.type)
您对如何解决这个问题有什么建议吗?
试试这个:
$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