Browse Source

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

Jose Lorenzo Rodriguez 12 years ago
parent
commit
ffd2396fc6
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/ORM/Query.php

+ 2 - 1
src/ORM/Query.php

@@ -876,7 +876,8 @@ class Query extends DatabaseQuery {
  * @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'];