mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Merge pull request #516 from dogmatic69/tree-behavior-optimization
Tree behavior optimization Fixes #2600
This commit is contained in:
commit
94db313e39
1 changed files with 4 additions and 2 deletions
|
@ -117,8 +117,10 @@ class TreeBehavior extends ModelBehavior {
|
||||||
*/
|
*/
|
||||||
public function beforeDelete($Model, $cascade = true) {
|
public function beforeDelete($Model, $cascade = true) {
|
||||||
extract($this->settings[$Model->alias]);
|
extract($this->settings[$Model->alias]);
|
||||||
list($name, $data) = array($Model->alias, $Model->read());
|
$data = current($Model->find('first', array(
|
||||||
$data = $data[$name];
|
'conditions' => array($Model->alias . '.' . $Model->primaryKey => $Model->id),
|
||||||
|
'fields' => array($Model->alias . '.' . $left, $Model->alias . '.' . $right),
|
||||||
|
'recursive' => -1)));
|
||||||
|
|
||||||
if (!$data[$right] || !$data[$left]) {
|
if (!$data[$right] || !$data[$left]) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue