Skip to content

Commit

Permalink
More replacements of assignation by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Oct 17, 2010
1 parent 122cb1e commit 28685dc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions cake/libs/model/datasources/dbo_source.php
Expand Up @@ -645,7 +645,7 @@ public function showLog($sorted = false) {
if (PHP_SAPI != 'cli') {
App::import('Core', 'View');
$controller = null;
$View =& new View($controller, false);
$View = new View($controller, false);
$View->set('logs', array($this->configKeyName => $log));
echo $View->element('sql_dump', array('_forced_from_dbo_' => true));
} else {
Expand Down Expand Up @@ -817,7 +817,7 @@ public function read(&$model, $queryData = array(), $recursive = null) {

foreach ($_associations as $type) {
foreach ($model->{$type} as $assoc => $assocData) {
$linkModel =& $model->{$assoc};
$linkModel = $model->{$assoc};
$external = isset($assocData['external']);

if ($model->useDbConfig == $linkModel->useDbConfig) {
Expand All @@ -842,16 +842,16 @@ public function read(&$model, $queryData = array(), $recursive = null) {
if ($model->recursive > -1) {
foreach ($_associations as $type) {
foreach ($model->{$type} as $assoc => $assocData) {
$linkModel =& $model->{$assoc};
$linkModel = $model->{$assoc};

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

if (isset($db) && method_exists($db, 'queryAssociation')) {
Expand Down Expand Up @@ -957,14 +957,14 @@ public function queryAssociation(&$model, &$linkModel, $type, $association, $ass
if ($recursive > 0) {
foreach ($linkModel->associations() as $type1) {
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
$deepModel =& $linkModel->{$assoc1};
$deepModel = $linkModel->{$assoc1};
$tmpStack = $stack;
$tmpStack[] = $assoc1;

if ($linkModel->useDbConfig === $deepModel->useDbConfig) {
$db =& $this;
$db = $this;
} else {
$db =& ConnectionManager::getDataSource($deepModel->useDbConfig);
$db = ConnectionManager::getDataSource($deepModel->useDbConfig);
}
$db->queryAssociation($linkModel, $deepModel, $type1, $assoc1, $assocData1, $queryData, true, $fetch, $recursive - 1, $tmpStack);
}
Expand Down Expand Up @@ -1026,15 +1026,15 @@ public function queryAssociation(&$model, &$linkModel, $type, $association, $ass
if ($recursive > 0) {
foreach ($linkModel->associations() as $type1) {
foreach ($linkModel->{$type1} as $assoc1 => $assocData1) {
$deepModel =& $linkModel->{$assoc1};
$deepModel = $linkModel->{$assoc1};

if (($type1 === 'belongsTo') || ($deepModel->alias === $model->alias && $type === 'belongsTo') || ($deepModel->alias != $model->alias)) {
$tmpStack = $stack;
$tmpStack[] = $assoc1;
if ($linkModel->useDbConfig == $deepModel->useDbConfig) {
$db =& $this;
$db = $this;
} else {
$db =& ConnectionManager::getDataSource($deepModel->useDbConfig);
$db = ConnectionManager::getDataSource($deepModel->useDbConfig);
}
$db->queryAssociation($linkModel, $deepModel, $type1, $assoc1, $assocData1, $queryData, true, $fetch, $recursive - 1, $tmpStack);
}
Expand Down

0 comments on commit 28685dc

Please sign in to comment.