public function rebuildTree($entityClass = '',
        $parentEntity)
    {
        if ($entityClass === '') {
            throw new Exception('messages.error.classNameNotProvided');
        }
        if ($parentEntity === null) {
            throw new Exception('messages.error.cantRemakeTree');
        }
        $dqlLft = '
                UPDATE ' . $entityClass . ' a
                SET a.lft = a.lft + 2
                WHERE a.lft > ' . $parentEntity->rgt . '
            ';
        $q = $this->query($dqlLft);
        $q->execute();

        $dqlRgt = '
                UPDATE ' . $entityClass . ' a
                SET a.rgt = a.rgt + 2
                WHERE a.rgt >= ' . $parentEntity->rgt . '
            ';
        $q2 = $this->query($dqlRgt);
        $q2->execute();
    }