Baum\Node::setDepth PHP Method

setDepth() public method

Sets the depth attribute.
public setDepth ( ) : Node
return Node
    public function setDepth()
    {
        $self = $this;
        $this->getConnection()->transaction(function () use($self) {
            $self->reload();
            $level = $self->getLevel();
            $self->newNestedSetQuery()->where($self->getKeyName(), '=', $self->getKey())->update([$self->getDepthColumnName() => $level]);
            $self->setAttribute($self->getDepthColumnName(), $level);
        });
        return $this;
    }

Usage Example

コード例 #1
0
ファイル: Region.php プロジェクト: kitbs/vinfo
 public function setDepth()
 {
     $this->saveTranslations();
     return parent::setDepth();
 }