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

parent() публичный Метод

Named scope. Gets parent of node.
public parent ( ) : Phalcon\Mvc\ModelInterface
Результат Phalcon\Mvc\ModelInterface
    public function parent()
    {
        $owner = $this->getOwner();
        $query = $owner::query()->where($this->leftAttribute . '<' . $owner->{$this->leftAttribute})->andWhere($this->rightAttribute . '>' . $owner->{$this->rightAttribute})->orderBy($this->rightAttribute)->limit(1);
        if ($this->hasManyRoots) {
            $query = $query->andWhere($this->rootAttribute . '=' . $owner->{$this->rootAttribute});
        }
        return $query->execute()->getFirst();
    }