Commit 44101abc authored by gyim's avatar gyim

FIX: Doctrine_Query::count() prevented execute() calls on the same query object

parent 32b564e7
...@@ -376,6 +376,8 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { ...@@ -376,6 +376,8 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
*/ */
public function count($params = array()) public function count($params = array())
{ {
$parts_old = $this->parts;
$this->remove('select'); $this->remove('select');
$join = $this->join; $join = $this->join;
$where = $this->where; $where = $this->where;
...@@ -408,6 +410,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable { ...@@ -408,6 +410,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$params = array_merge($this->params, $params); $params = array_merge($this->params, $params);
$this->parts = $parts_old;
return (int) $this->getConnection()->fetchOne($q, $params); return (int) $this->getConnection()->fetchOne($q, $params);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment