Skip to content

Commit

Permalink
Removing mor assignments by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Oct 17, 2010
1 parent bcc1417 commit 122cb1e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cake/libs/model/behaviors/tree.php
Expand Up @@ -65,7 +65,7 @@ public function setup(&$Model, $config = array()) {

if (in_array($settings['scope'], $Model->getAssociated('belongsTo'))) {
$data = $Model->getAssociated($settings['scope']);
$parent =& $Model->{$settings['scope']};
$parent = $Model->{$settings['scope']};
$settings['scope'] = $Model->alias . '.' . $data['foreignKey'] . ' = ' . $parent->alias . '.' . $parent->primaryKey;
$settings['recursive'] = 0;
}
Expand Down Expand Up @@ -599,7 +599,7 @@ public function recover(&$Model, $mode = 'parent', $missingParentAction = null)
$this->_setParent($Model, $array[$Model->alias][$parent]);
}
} else {
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
$db = ConnectionManager::getDataSource($Model->useDbConfig);
foreach ($Model->find('all', array('conditions' => $scope, 'fields' => array($Model->primaryKey, $parent), 'order' => $left)) as $array) {
$path = $this->getPath($Model, $array[$Model->alias][$Model->primaryKey]);
if ($path == null || count($path) < 2) {
Expand Down Expand Up @@ -702,7 +702,7 @@ public function removeFromTree(&$Model, $id = null, $delete = false) {
$parentNode[$right] = $node[$right] + 1;
}

$db =& ConnectionManager::getDataSource($Model->useDbConfig);
$db = ConnectionManager::getDataSource($Model->useDbConfig);
$Model->updateAll(
array($parent => $db->value($node[$parent], $parent)),
array($Model->escapeField($parent) => $node[$Model->primaryKey])
Expand Down Expand Up @@ -888,7 +888,7 @@ protected function _setParent(&$Model, $parentId = null, $created = false) {
* @access private
*/
function __getMax($Model, $scope, $right, $recursive = -1, $created = false) {
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
$db = ConnectionManager::getDataSource($Model->useDbConfig);
if ($created) {
if (is_string($scope)) {
$scope .= " AND {$Model->alias}.{$Model->primaryKey} <> ";
Expand Down Expand Up @@ -916,7 +916,7 @@ function __getMax($Model, $scope, $right, $recursive = -1, $created = false) {
* @access private
*/
function __getMin($Model, $scope, $left, $recursive = -1) {
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
$db = ConnectionManager::getDataSource($Model->useDbConfig);
$name = $Model->alias . '.' . $left;
list($edge) = array_values($Model->find('first', array(
'conditions' => $scope,
Expand Down

0 comments on commit 122cb1e

Please sign in to comment.