1
0
mirror of synced 2025-01-18 06:21:40 +03:00

new method isDistinct

This commit is contained in:
zYne 2006-09-17 18:31:28 +00:00
parent 41ee9173f1
commit 1b0d2c78b2

View File

@ -43,6 +43,8 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
private $tableStack;
private $relationStack = array();
private $distinct;
/**
* create
* returns a new Doctrine_Query object
@ -60,6 +62,13 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
public function getRelationStack() {
return $this->relationStack;
}
public function isDistinct($distinct = null) {
if(isset($distinct))
$this->isDistinct = (bool) $distinct;
return $this->isDistinct;
}
/**
* count
*
@ -293,7 +302,12 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
}
// build the basic query
$q = "SELECT ".implode(", ",$this->parts["select"]).
$str = '';
if($this->isDistinct())
$str = 'DISTINCT ';
$q = "SELECT ".$str.implode(", ",$this->parts["select"]).
" FROM ";
foreach($this->parts["from"] as $tname => $bool) {