Пример #1
0
 /**
  * Clears tree.
  *
  * Important!!!
  *     this method will destroy all data in the tree
  *
  * @param array|Axis_NSTree_Node $data
  * @return int|Axis_NSTree_Node
  */
 public function clear($data = array())
 {
     // delete structure .... oops
     $this->_table->delete('');
     if ($this->_2tables) {
         // delete data ....oops
         $this->_table2->delete('');
     }
     // create root
     $columns = array($this->_left => 1, $this->_right => 2, $this->_level => 0);
     $id = $this->_table->insert($columns);
     // bind data
     return $this->_bindNode($id, $data);
 }