1
0
mirror of synced 2025-01-31 12:32:59 +03:00

Fixed a missing space in the query build by count()

Fixed count()'s code formatting (was tabs in some lines)
fixes #171
Ticket: 171
This commit is contained in:
Tanken 2006-10-16 10:04:38 +00:00
parent a2299b2a25
commit 075a58089a

View File

@ -69,21 +69,21 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
return $this->isDistinct;
}
/**
* count
/**
* count
*
* @return integer
* @return integer
*/
public function count(Doctrine_Table $table, $params = array()) {
$this->remove('select');
$join = $this->join;
$where = $this->where;
$having = $this->having;
public function count(Doctrine_Table $table, $params = array()) {
$this->remove('select');
$join = $this->join;
$where = $this->where;
$having = $this->having;
$q = "SELECT COUNT(DISTINCT ".$table->getTableName().'.'.$table->getIdentifier().") FROM ".$table->getTableName()." ";
foreach($join as $j) {
$q .= implode(" ",$j);
}
$q = "SELECT COUNT(DISTINCT ".$table->getTableName().'.'.$table->getIdentifier().") FROM ".$table->getTableName()." ";
foreach($join as $j) {
$q .= " ".implode(" ",$j);
}
$string = $this->applyInheritance();
if( ! empty($where)) {
@ -95,12 +95,12 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
$q .= " WHERE (".$string.")";
}
if( ! empty($having))
$q .= " HAVING ".implode(' AND ',$having);
if( ! empty($having))
$q .= " HAVING ".implode(' AND ',$having);
$a = $this->getConnection()->execute($q, $params)->fetch(PDO::FETCH_NUM);
return $a[0];
}
$a = $this->getConnection()->execute($q, $params)->fetch(PDO::FETCH_NUM);
return $a[0];
}
/**
* loadFields
* loads fields for a given table and