refactoring DboSource::_mergeConditions()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7540 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
DarkAngelBGE 2008-09-01 19:31:28 +00:00
parent 0b8006625c
commit 58bbba0c4f

View file

@ -586,6 +586,7 @@ class DboSource extends DataSource {
*/
function read(&$model, $queryData = array(), $recursive = null) {
$queryData = $this->__scrubQueryData($queryData);
$null = null;
$array = array();
$linkedModels = array();
@ -624,6 +625,7 @@ class DboSource extends DataSource {
}
$query = $this->generateAssociationQuery($model, $null, null, null, null, $queryData, false, $null);
$resultSet = $this->fetchAll($query, $model->cacheQueries, $model->alias);
if ($resultSet === false) {
@ -1084,6 +1086,7 @@ class DboSource extends DataSource {
$assocData['conditions'],
$this->getConstraint($type, $model, $linkModel, $alias, array_merge($assocData, compact('external', 'self')))
);
if ($external) {
$query = array_merge($assocData, array(
'conditions' => $conditions,
@ -1318,10 +1321,14 @@ class DboSource extends DataSource {
* @return array
*/
function __mergeConditions($query, $assoc) {
if (!empty($assoc)) {
if (empty($assoc)) {
return $query;
}
if (is_array($query)) {
return array_merge((array)$assoc, $query);
} else {
}
if (!empty($query)) {
$query = array($query);
if (is_array($assoc)) {
@ -1330,13 +1337,10 @@ class DboSource extends DataSource {
$query[] = $assoc;
}
return $query;
} else {
}
return $assoc;
}
}
}
return $query;
}
/**
* Generates and executes an SQL UPDATE statement for given model, fields, and values.
* For databases that do not support aliases in UPDATE queries.