Permalink
Browse files

Fix issues with TreeBehavior and nested deletes.

Fixes #3481
  • Loading branch information...
1 parent 1612bdf commit d70730d72200862806209a133b43a2f099e0fa8c @markstory markstory committed Dec 20, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/Cake/Model/Behavior/TreeBehavior.php
@@ -52,7 +52,7 @@ class TreeBehavior extends ModelBehavior {
*
* @var array
*/
- protected $_deletedRow = null;
+ protected $_deletedRow = array();
/**
* Initiate Tree behavior
@@ -129,7 +129,7 @@ public function beforeDelete(Model $Model, $cascade = true) {
'fields' => array($Model->escapeField($left), $Model->escapeField($right)),
'recursive' => -1));
if ($data) {
- $this->_deletedRow = current($data);
+ $this->_deletedRow[$Model->alias] = current($data);
}
return true;
}
@@ -144,8 +144,8 @@ public function beforeDelete(Model $Model, $cascade = true) {
*/
public function afterDelete(Model $Model) {
extract($this->settings[$Model->alias]);
- $data = $this->_deletedRow;
- $this->_deletedRow = null;
+ $data = $this->_deletedRow[$Model->alias];
+ $this->_deletedRow[$Model->alias] = null;
if (!$data[$right] || !$data[$left]) {
return true;

0 comments on commit d70730d

Please sign in to comment.