Skip to content
Permalink
Browse files

Removing mor assignments by reference

  • Loading branch information...
lorenzo committed Oct 17, 2010
1 parent bcc1417 commit 122cb1ec5beff07c3993a0ff5b9be97c839f8205
Showing with 5 additions and 5 deletions.
  1. +5 −5 cake/libs/model/behaviors/tree.php
@@ -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;
}
@@ -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) {
@@ -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])
@@ -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} <> ";
@@ -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,

0 comments on commit 122cb1e

Please sign in to comment.
You can’t perform that action at this time.