Long description for file
Inheritance: extends ModelBehavior
Esempio n. 1
0
 /**
  * Check if the current tree is valid.
  *
  * Returns true if the tree is valid otherwise an array of (type, incorrect left/right index, message)
  *
  * @param AppModel $Model Model instance
  * @param string $scope The scoped used to select the tree to verify
  * @return mixed true if the tree is valid or empty, otherwise an array of (error type [index, node],
  *  [incorrect left/right index,node id], message)
  * @access public
  * @link http://book.cakephp.org/view/1630/Verify
  */
 public function verify($Model, $scope = null)
 {
     if ($this->scoped($Model)) {
         $this->__setScope($Model, $scope);
     }
     return parent::verify($Model);
 }
 /**
  * Identifies the ids of the nodes whose counter caches need updating. I.e.
  * all parents of the current node
  *
  * @param AppModel $model The model object that the behavior is attached to
  * @return boolean Always true
  * @access public
  */
 function beforeDelete(&$model)
 {
     $this->_parentIds[$model->alias] = array();
     // Get parent before delete logic out of the way
     parent::beforeDelete($model);
     // Get the current/previous parent id
     $currentParentId = $model->field($this->settings[$model->alias]['parent']);
     // Add the current/previous parent id and it's parents to the _parentIds
     // property for updating in afterSave
     $this->_addParentIds($model, $currentParentId);
     return true;
 }