Baum\Node::shiftSiblingsForRestore PHP Method

shiftSiblingsForRestore() public method

"Makes room" for the the current node between its siblings.
public shiftSiblingsForRestore ( ) : void
return void
    public function shiftSiblingsForRestore()
    {
        if (is_null($this->getRight()) || is_null($this->getLeft())) {
            return;
        }
        $self = $this;
        $this->getConnection()->transaction(function () use($self) {
            $lftCol = $self->getLeftColumnName();
            $rgtCol = $self->getRightColumnName();
            $lft = $self->getLeft();
            $rgt = $self->getRight();
            $diff = $rgt - $lft + 1;
            $self->newNestedSetQuery()->where($lftCol, '>=', $lft)->increment($lftCol, $diff);
            $self->newNestedSetQuery()->where($rgtCol, '>=', $lft)->increment($rgtCol, $diff);
        });
    }