1
0
mirror of synced 2025-01-06 00:57:10 +03:00

added leftJoin and innerJoin methods

This commit is contained in:
zYne 2006-12-15 23:07:01 +00:00
parent e33bd03aa8
commit a81e1d766f

View File

@ -273,9 +273,9 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
foreach($names as $name) { foreach($names as $name) {
if($count == 0) { if($count == 0) {
$this->parts["select"][] = $tablename . '.' . $name; $this->parts['select'][] = $tablename . '.' . $name;
} else { } else {
$this->parts["select"][] = $tablename . '.' . $name . ' AS ' . $tablename . '__' . $name; $this->parts['select'][] = $tablename . '.' . $name . ' AS ' . $tablename . '__' . $name;
} }
} }
} }
@ -285,10 +285,30 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
* @param strint $from * @param strint $from
*/ */
public function addFrom($from) { public function addFrom($from) {
$class = "Doctrine_Query_From"; $class = 'Doctrine_Query_From';
$parser = new $class($this); $parser = new $class($this);
$parser->parse($from); $parser->parse($from);
} }
/**
* leftJoin
*
* @param strint $join
*/
public function leftJoin($join) {
$class = 'Doctrine_Query_From';
$parser = new $class($this);
$parser->parse('LEFT JOIN '. $join);
}
/**
* innerJoin
*
* @param strint $join
*/
public function innerJoin($join) {
$class = 'Doctrine_Query_From';
$parser = new $class($this);
$parser->parse('INNER JOIN '. $join);
}
/** /**
* addWhere * addWhere
* *
@ -296,7 +316,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
* @param mixed $params * @param mixed $params
*/ */
public function addWhere($where, $params = array()) { public function addWhere($where, $params = array()) {
$class = "Doctrine_Query_Where"; $class = 'Doctrine_Query_Where';
$parser = new $class($this); $parser = new $class($this);
$this->parts['where'][] = $parser->parse($where); $this->parts['where'][] = $parser->parse($where);