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

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

Determines if node is descendant of subject node.
public isDescendantOf ( Phalcon\Mvc\ModelInterface $subj ) : boolean
$subj Phalcon\Mvc\ModelInterface the subject node.
Результат boolean whether the node is descendant of subject node.
    public function isDescendantOf($subj)
    {
        $owner = $this->getOwner();
        $result = $owner->{$this->leftAttribute} > $subj->{$this->leftAttribute} && $owner->{$this->rightAttribute} < $subj->{$this->rightAttribute};
        if ($this->hasManyRoots) {
            $result = $result && $owner->{$this->rootAttribute} === $subj->{$this->rootAttribute};
        }
        return $result;
    }