mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Removing mor assignments by reference
This commit is contained in:
parent
bcc1417e5d
commit
122cb1ec5b
1 changed files with 5 additions and 5 deletions
|
@ -65,7 +65,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
|
|
||||||
if (in_array($settings['scope'], $Model->getAssociated('belongsTo'))) {
|
if (in_array($settings['scope'], $Model->getAssociated('belongsTo'))) {
|
||||||
$data = $Model->getAssociated($settings['scope']);
|
$data = $Model->getAssociated($settings['scope']);
|
||||||
$parent =& $Model->{$settings['scope']};
|
$parent = $Model->{$settings['scope']};
|
||||||
$settings['scope'] = $Model->alias . '.' . $data['foreignKey'] . ' = ' . $parent->alias . '.' . $parent->primaryKey;
|
$settings['scope'] = $Model->alias . '.' . $data['foreignKey'] . ' = ' . $parent->alias . '.' . $parent->primaryKey;
|
||||||
$settings['recursive'] = 0;
|
$settings['recursive'] = 0;
|
||||||
}
|
}
|
||||||
|
@ -599,7 +599,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
$this->_setParent($Model, $array[$Model->alias][$parent]);
|
$this->_setParent($Model, $array[$Model->alias][$parent]);
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
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]);
|
$path = $this->getPath($Model, $array[$Model->alias][$Model->primaryKey]);
|
||||||
if ($path == null || count($path) < 2) {
|
if ($path == null || count($path) < 2) {
|
||||||
|
@ -702,7 +702,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
$parentNode[$right] = $node[$right] + 1;
|
$parentNode[$right] = $node[$right] + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
|
$db = ConnectionManager::getDataSource($Model->useDbConfig);
|
||||||
$Model->updateAll(
|
$Model->updateAll(
|
||||||
array($parent => $db->value($node[$parent], $parent)),
|
array($parent => $db->value($node[$parent], $parent)),
|
||||||
array($Model->escapeField($parent) => $node[$Model->primaryKey])
|
array($Model->escapeField($parent) => $node[$Model->primaryKey])
|
||||||
|
@ -888,7 +888,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __getMax($Model, $scope, $right, $recursive = -1, $created = false) {
|
function __getMax($Model, $scope, $right, $recursive = -1, $created = false) {
|
||||||
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
|
$db = ConnectionManager::getDataSource($Model->useDbConfig);
|
||||||
if ($created) {
|
if ($created) {
|
||||||
if (is_string($scope)) {
|
if (is_string($scope)) {
|
||||||
$scope .= " AND {$Model->alias}.{$Model->primaryKey} <> ";
|
$scope .= " AND {$Model->alias}.{$Model->primaryKey} <> ";
|
||||||
|
@ -916,7 +916,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __getMin($Model, $scope, $left, $recursive = -1) {
|
function __getMin($Model, $scope, $left, $recursive = -1) {
|
||||||
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
|
$db = ConnectionManager::getDataSource($Model->useDbConfig);
|
||||||
$name = $Model->alias . '.' . $left;
|
$name = $Model->alias . '.' . $left;
|
||||||
list($edge) = array_values($Model->find('first', array(
|
list($edge) = array_values($Model->find('first', array(
|
||||||
'conditions' => $scope,
|
'conditions' => $scope,
|
||||||
|
|
Loading…
Add table
Reference in a new issue