/** * {@inheritdoc} */ public function isAncestor(CategoryInterface $parentNode, CategoryInterface $childNode) { $sameRoot = $parentNode->getRoot() === $childNode->getRoot(); $isAncestor = $childNode->getLeft() > $parentNode->getLeft() && $childNode->getRight() < $parentNode->getRight(); return $sameRoot && $isAncestor; }