Permalink
Browse files

Fixing Query::count() to be aware of formatters

  • Loading branch information...
1 parent e1f29f0 commit ffd2396fc682441f4b45cc8b5b8b4ba34ade51ae @lorenzo lorenzo committed Jan 19, 2014
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/ORM/Query.php
View
@@ -876,7 +876,8 @@ public function first() {
* @return integer
*/
public function count() {
- if ($this->clause('group') === [] && $this->mapReduce() === []) {
+ $noFormatters = $this->mapReduce() === [] && empty($this->_formatters);
+ if ($this->clause('group') === [] && $noFormatters) {
$this->select(['count' => $this->func()->count('*')], true)
->hydrate(false);
return (int)$this->first()['count'];

0 comments on commit ffd2396

Please sign in to comment.