Skip to content

Commit

Permalink
More changes in read.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Feb 26, 2011
1 parent ef6632a commit 34b4ff9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cake/libs/model/datasources/dbo_source.php
Expand Up @@ -1077,7 +1077,6 @@ public function read($model, $queryData = array(), $recursive = null) {
$query = trim($this->generateAssociationQuery($model, null, null, null, null, $queryData, false, $null));

$resultSet = $this->fetchAll($query, $model->cacheQueries);

if ($resultSet === false) {
$model->onError();
return false;
Expand All @@ -1090,13 +1089,13 @@ public function read($model, $queryData = array(), $recursive = null) {
foreach ($model->{$type} as $assoc => $assocData) {
$linkModel = $model->{$assoc};

if (empty($linkedModels[$type . '/' . $assoc])) {
if ($model->useDbConfig == $linkModel->useDbConfig) {
if (!isset($linkedModels[$type . '/' . $assoc])) {
if ($model->useDbConfig === $linkModel->useDbConfig) {
$db = $this;
} else {
$db = ConnectionManager::getDataSource($linkModel->useDbConfig);
}
} elseif ($model->recursive > 1 && ($type == 'belongsTo' || $type == 'hasOne')) {
} elseif ($model->recursive > 1 && ($type === 'belongsTo' || $type === 'hasOne')) {
$db = $this;
}

Expand All @@ -1106,7 +1105,7 @@ public function read($model, $queryData = array(), $recursive = null) {
unset($db);

if ($type === 'hasMany') {
$filtered []= $assoc;
$filtered[] = $assoc;
}
}
}
Expand Down

0 comments on commit 34b4ff9

Please sign in to comment.