Skip to content
Permalink
Browse files

optimization of tree behavior as per ticket #2600

  • Loading branch information...
dogmatic69 committed Feb 23, 2012
1 parent b730285 commit 74a84c96f138b4c6e5ff88924f9998c0717cbc80
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/Cake/Model/Behavior/TreeBehavior.php
@@ -117,8 +117,9 @@ public function beforeFind($Model, $query) {
*/
public function beforeDelete($Model, $cascade = true) {
extract($this->settings[$Model->alias]);
list($name, $data) = array($Model->alias, $Model->read());
$data = $data[$name];
$data = current($Model->find('first', array(
'conditions' => array($Model->alias . '.' . $Model->primaryKey => $Model->id),
'fields' => array($Model->alias . '.' . $left, $Model->alias . '.' . $right))));
if (!$data[$right] || !$data[$left]) {
return true;

0 comments on commit 74a84c9

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