Phalcon\Mvc\Model\Behavior\NestedSet::shiftLeftRight PHP Метод

shiftLeftRight() приватный Метод

private shiftLeftRight ( integer $key, integer $delta, Phalcon\Mvc\ModelInterface $model = null ) : boolean
$key integer
$delta integer
$model Phalcon\Mvc\ModelInterface
Результат boolean
    private function shiftLeftRight($key, $delta, ModelInterface $model = null)
    {
        $owner = $model ?: $this->getOwner();
        foreach ([$this->leftAttribute, $this->rightAttribute] as $attribute) {
            $condition = $attribute . '>=' . $key;
            if ($this->hasManyRoots) {
                $condition .= ' AND ' . $this->rootAttribute . '=' . $owner->{$this->rootAttribute};
            }
            foreach ($owner::find($condition) as $i) {
                /** @var ModelInterface $i */
                if ($i->update([$attribute => $i->{$attribute} + $delta]) == false) {
                    $this->db->rollback();
                    $this->ignoreEvent = false;
                    return false;
                }
            }
        }
        return true;
    }