|  |  | @ -61,6 +61,11 @@ class NestedSetsBehavior extends Behavior | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     protected $node; |  |  |  |     protected $node; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @var string | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     protected $treeChange; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * @inheritdoc |  |  |  |      * @inheritdoc | 
			
		
	
	
		
		
			
				
					|  |  | @ -395,8 +400,9 @@ class NestedSetsBehavior extends Behavior | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if ($this->treeAttribute === null) { |  |  |  |                 if ($this->treeAttribute === null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     throw new Exception('Can not move a node as the root when "treeAttribute" is not set.'); |  |  |  |                     throw new Exception('Can not move a node as the root when "treeAttribute" is not set.'); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if ($this->isRoot()) { |  |  |  |                 if ($this->owner->getOldAttribute($this->treeAttribute) !== $this->owner->getAttribute($this->treeAttribute)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     throw new Exception('Can not move the root node as the root.'); |  |  |  |                     $this->treeChange = $this->owner->getAttribute($this->treeAttribute); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     $this->owner->setAttribute($this->treeAttribute, $this->owner->getOldAttribute($this->treeAttribute)); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 break; |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -448,8 +454,9 @@ class NestedSetsBehavior extends Behavior | 
			
		
	
		
		
			
				
					
					|  |  |  |                 $this->moveNode($this->node->getAttribute($this->rightAttribute) + 1, 0); |  |  |  |                 $this->moveNode($this->node->getAttribute($this->rightAttribute) + 1, 0); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 break; |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         $this->operation = null; |  |  |  |         $this->operation  = null; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         $this->node      = null; |  |  |  |         $this->node       = null; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         $this->treeChange = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
	
		
		
			
				
					|  |  | @ -589,10 +596,7 @@ class NestedSetsBehavior extends Behavior | 
			
		
	
		
		
			
				
					
					|  |  |  |         $left   = $this->owner->getAttribute($this->leftAttribute); |  |  |  |         $left   = $this->owner->getAttribute($this->leftAttribute); | 
			
		
	
		
		
			
				
					
					|  |  |  |         $right  = $this->owner->getAttribute($this->rightAttribute); |  |  |  |         $right  = $this->owner->getAttribute($this->rightAttribute); | 
			
		
	
		
		
			
				
					
					|  |  |  |         $depth  = $this->owner->getAttribute($this->depthAttribute); |  |  |  |         $depth  = $this->owner->getAttribute($this->depthAttribute); | 
			
		
	
		
		
			
				
					
					|  |  |  |         $tree   = $this->owner->getPrimaryKey(); |  |  |  |         $tree   = $this->treeChange ? $this->treeChange : $this->owner->getPrimaryKey(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if ($this->owner->getOldAttribute($this->treeAttribute) !== $this->owner->getAttribute($this->treeAttribute)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             $tree = $this->owner->getAttribute($this->treeAttribute); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         $this->owner->updateAll( |  |  |  |         $this->owner->updateAll( | 
			
		
	
		
		
			
				
					
					|  |  |  |             [ |  |  |  |             [ | 
			
		
	
	
		
		
			
				
					|  |  | 
 |