Beispiel #1
0
 protected function beforeUpdate()
 {
     // if this item's parent is different from it's parent in the database, then we also need to update all the children
     $old = (new static())->load(array('_id' => $this->_id));
     if ($old->parent != $this->parent || $old->title != $this->title) {
         // update children after save
         $this->__options['update_children'] = true;
     }
     return parent::beforeUpdate();
 }
Beispiel #2
0
 protected function beforeUpdate()
 {
     // get the old version so we can do some comparisons
     $this->__oldNode = (new static())->load(array('_id' => $this->id));
     // are we moving the node? or just updating its details?
     $this->__isMoving = false;
     if ($this->__oldNode->parent != $this->parent || $this->__oldNode->tree != $this->tree) {
         $this->__isMoving = true;
     }
     // do we need to update the children after save?
     $this->__update_children = isset($this->__update_children) ? $this->__update_children : false;
     if ($this->__oldNode->tree != $this->tree || $this->__oldNode->parent != $this->parent || $this->__oldNode->title != $this->title || $this->__oldNode->path != $this->path) {
         // update children after save
         $this->__update_children = true;
     }
     return parent::beforeUpdate();
 }