public function deleteTreeItem($entityClass = '',
        $id)
    {
        if ($entityClass === '') {
            throw new Exception('messages.error.classNameNotProvided');
        }
        $entity = $this->findById($id);
        $difference = $entity->rgt - $entity->lft + 1;

        $deleteTree = '
                DELETE FROM ' . $entityClass . ' a
                WHERE a.lft >= ' . $entity->lft . '
                    AND a.rgt <= ' . $entity->rgt . '
            ';
        $qTree = $this->query($deleteTree);
        $qTree->execute();

        $updateLft = '
                UPDATE ' . $entityClass . ' a
                SET a.lft = a.lft - ' . $difference . '
                WHERE a.lft > ' . $entity->rgt . '
            ';
        $qLft = $this->query($updateLft);
        $qLft->execute();

        $updateRgt = '
                UPDATE ' . $entityClass . ' a
                SET a.rgt = a.rgt - ' . $difference . '
                WHERE a.rgt > ' . $entity->rgt . '
            ';
        $qRgt = $this->query($updateRgt);
        $qRgt->execute();
    }
public function deleteTreeItem($entityClass = '',
        $id)
    {
        if ($entityClass === '') {
            throw new Exception('messages.error.classNameNotProvided');
        }
        $entity = $this->findById($id);
        $difference = $entity->rgt - $entity->lft + 1;

        $deleteTree = '
                DELETE FROM ' . $entityClass . ' a
                WHERE a.lft >= ' . $entity->lft . '
                    AND a.rgt <= ' . $entity->rgt . '
            ';
        $qTree = $this->query($deleteTree);
        $qTree->execute();

        $updateLft = '
                UPDATE ' . $entityClass . ' a
                SET a.lft = a.lft - ' . $difference . '
                WHERE a.lft > ' . $entity->rgt . '
            ';
        $qLft = $this->query($updateLft);
        $qLft->execute();

        $updateRgt = '
                UPDATE ' . $entityClass . ' a
                SET a.rgt = a.rgt - ' . $difference . '
                WHERE a.rgt > ' . $entity->rgt . '
            ';
        $qRgt = $this->query($updateRgt);
        $qRgt->execute();
    }
public function deleteTreeItem ( $ entityClass = '' , $ id ) { if ( $ entityClass === '' ) { throw new Exception ( 'messages.error.classNameNotProvided' ) ; } $ entity = $ this -> findById ( $ id ) ; $ difference = $ entity -> rgt - $ entity -> lft + 1 ; $ deleteTree = '
                DELETE FROM ' . $ entityClass . ' a
                WHERE a.lft >= ' . $ entity -> lft . '
                    AND a.rgt <= ' . $ entity -> rgt . '
            ' ; $ qTree = $ this -> query ( $ deleteTree ) ; $ qTree -> execute ( ) ; $ updateLft = '
                UPDATE ' . $ entityClass . ' a
                SET a.lft = a.lft - ' . $ difference . '
                WHERE a.lft > ' . $ entity -> rgt . '
            ' ; $ qLft = $ this -> query ( $ updateLft ) ; $ qLft -> execute ( ) ; $ updateRgt = '
                UPDATE ' . $ entityClass . ' a
                SET a.rgt = a.rgt - ' . $ difference . '
                WHERE a.rgt > ' . $ entity -> rgt . '
            ' ; $ qRgt = $ this -> query ( $ updateRgt ) ; $ qRgt -> execute ( ) ; }
Deletes a tree node and updates rest of the tree
@param type $entityClass Class with defined entity
@param type $id
Deletes a tree node and updates rest of the tree