1
0
mirror of synced 2024-12-13 14:56:01 +03:00

Added support to params in join methods of Doctrine_Query

This commit is contained in:
guilhermeblanco 2007-12-26 20:52:37 +00:00
parent c2282dac7b
commit 260b9ae291
2 changed files with 19 additions and 5 deletions

View File

@ -294,7 +294,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable, Seria
*/ */
public function getParams() public function getParams()
{ {
return array_merge($this->_params['set'], $this->_params['where'], $this->_params['having']); return array_merge($this->_params['join'], $this->_params['set'], $this->_params['where'], $this->_params['having']);
} }
/** /**

View File

@ -102,7 +102,8 @@ abstract class Doctrine_Query_Abstract
/** /**
* @var array $params The parameters of this query. * @var array $params The parameters of this query.
*/ */
protected $_params = array('where' => array(), protected $_params = array('join' => array(),
'where' => array(),
'set' => array(), 'set' => array(),
'having' => array()); 'having' => array());
@ -913,7 +914,8 @@ abstract class Doctrine_Query_Abstract
*/ */
public function execute($params = array(), $hydrationMode = null) public function execute($params = array(), $hydrationMode = null)
{ {
$params = array_merge($this->_params['set'], $params = array_merge($this->_params['join'],
$this->_params['set'],
$this->_params['where'], $this->_params['where'],
$this->_params['having'], $this->_params['having'],
$params); $params);
@ -1280,8 +1282,14 @@ abstract class Doctrine_Query_Abstract
* @param string $join Query INNER JOIN * @param string $join Query INNER JOIN
* @return Doctrine_Query * @return Doctrine_Query
*/ */
public function innerJoin($join) public function innerJoin($join, $params = array())
{ {
if (is_array($params)) {
$this->_params['join'] = array_merge($this->_params['join'], $params);
} else {
$this->_params['join'][] = $params;
}
return $this->_addDqlQueryPart('from', 'INNER JOIN ' . $join, true); return $this->_addDqlQueryPart('from', 'INNER JOIN ' . $join, true);
} }
@ -1292,8 +1300,14 @@ abstract class Doctrine_Query_Abstract
* @param string $join Query LEFT JOIN * @param string $join Query LEFT JOIN
* @return Doctrine_Query * @return Doctrine_Query
*/ */
public function leftJoin($join) public function leftJoin($join, $params = array())
{ {
if (is_array($params)) {
$this->_params['join'] = array_merge($this->_params['join'], $params);
} else {
$this->_params['join'][] = $params;
}
return $this->_addDqlQueryPart('from', 'LEFT JOIN ' . $join, true); return $this->_addDqlQueryPart('from', 'LEFT JOIN ' . $join, true);
} }