Removing mor assignments by reference

This commit is contained in:
José Lorenzo Rodríguez 2010-10-17 18:58:03 -04:30
parent bcc1417e5d
commit 122cb1ec5b

View file

@ -65,7 +65,7 @@ class TreeBehavior extends ModelBehavior {
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 @@ class TreeBehavior extends ModelBehavior {
$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 @@ class TreeBehavior extends ModelBehavior {
$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 @@ class TreeBehavior extends ModelBehavior {
* @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 @@ class TreeBehavior extends ModelBehavior {
* @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,