public function delete()
    {
        $em = $this->getManager()->getEntityManager();
        $lftField = $this->getLeftFieldName();
        $rgtField = $this->getRightFieldName();

        $oldLft = $this->getLeftValue();
        $oldRgt = $this->getRightValue();
        $oldRoot = $this->hasManyRoots() ? $this->getRootValue() : null;

        // beginTransaction
        $em->getConnection()->beginTransaction();
        try
        {
            $qb = $em->createQueryBuilder()
                ->delete(get_class($this->getNode()), 'n')
                ->where("n.$lftField >= ?1")
                ->setParameter(1, $oldLft)
                ->andWhere("n.$rgtField <= ?2")
                ->setParameter(2, $oldRgt);
            if($this->hasManyRoots())
            {
                $qb->andWhere("n.".$this->getRootFieldName()." = ?3")
                    ->setParameter(3, $oldRoot);
            }
            $qb->getQuery()->execute();
            $this->getManager()->removeNodes($oldLft, $oldRgt, $oldRoot);

            // Close gap in tree
            $first = $oldRgt + 1;
            $delta = $oldLft - $oldRgt - 1;
            $this->shiftRLRange($first, 0, $delta, $oldRoot);

            $em->flush();
            $em->getConnection()->commit();
        }
        catch (\Exception $e)
        {
            // @codeCoverageIgnoreStart
            $em->close();
            $em->getConnection()->rollback();
            throw $e;
            // @codeCoverageIgnoreEnd
        }
        // endTransaction
    }