src/Titon/Db/Behavior/HierarchyBehavior.php
public function preDelete(Event $event, Query $query, $id) {
        if (!$this->getConfig('onDelete')) {
            return true;
        }

        if ($node = $this->getNode($id)) {
            $count = $this->getRepository()->select()
                ->where($this->getConfig('parentField'), $id)
                ->count();

            if ($count) {
                return false;
            }

            $this->_deleteIndex = $node[$this->getConfig('leftField')];
        }

        return true;
    }
public function preDelete(Event $event, Query $query, $id) {
        if (!$this->getConfig('onDelete')) {
            return true;
        }

        if ($node = $this->getNode($id)) {
            $count = $this->getRepository()->select()
                ->where($this->getConfig('parentField'), $id)
                ->count();

            if ($count) {
                return false;
            }

            $this->_deleteIndex = $node[$this->getConfig('leftField')];
        }

        return true;
    }
public function preDelete ( Event $ event , Query $ query , $ id ) { if ( ! $ this -> getConfig ( 'onDelete' ) ) { return true ; } if ( $ node = $ this -> getNode ( $ id ) ) { $ count = $ this -> getRepository ( ) -> select ( ) -> where ( $ this -> getConfig ( 'parentField' ) , $ id ) -> count ( ) ; if ( $ count ) { return false ; } $ this -> _deleteIndex = $ node [ $ this -> getConfig ( 'leftField' ) ] ; } return true ; }
Before a delete, fetch the node and save its left index.
If a node has children, the delete will fail.

@param \Titon\Event\Event $event
@param \Titon\Db\Query $query
@param int|int[] $id
@return bool
Before a delete fetch the node and save its left index . If a node has children the delete will fail .