コード例 #1
0
ファイル: Tree.php プロジェクト: kstep/pnut
 public function remove($recursive = false)
 {
     if ($recursive) {
         $children = $this->getDescendantsId();
         $this->_db->delete($this->_table, array($this->_pk => $children));
         parent::remove();
     } else {
         $children = $this->getChildren();
         if (count($children)) {
             throw new Model_Exception("Can't remove non-leaf tree item");
         } else {
             parent::remove();
         }
     }
 }