public function loadLevel(string $categoryId, SalesChannelContext $context): ?Tree
    {
        /** @var CategoryEntity $active */
        $active = $this->loadActive($categoryId, $context);

        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('visible', true));
        $criteria->addFilter(new MultiFilter(
            MultiFilter::CONNECTION_OR,
            [
                new EqualsFilter('category.id', $categoryId),
                new EqualsFilter('category.parentId', $categoryId),
            ]
        ));

        /** @var CategoryCollection $categories */
        $categories = $this->categoryRepository->search($criteria, $context)->getEntities();
        $parentId = $categories->get($categoryId)->getParentId();

        return $this->getTree($parentId, $categories, $active);
    }
public function loadLevel(string $categoryId, SalesChannelContext $context): ?Tree
    {
        /** @var CategoryEntity $active */
        $active = $this->loadActive($categoryId, $context);

        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('visible', true));
        $criteria->addFilter(new MultiFilter(
            MultiFilter::CONNECTION_OR,
            [
                new EqualsFilter('category.id', $categoryId),
                new EqualsFilter('category.parentId', $categoryId),
            ]
        ));

        /** @var CategoryCollection $categories */
        $categories = $this->categoryRepository->search($criteria, $context)->getEntities();
        $parentId = $categories->get($categoryId)->getParentId();

        return $this->getTree($parentId, $categories, $active);
    }
public function loadLevel ( string $ categoryId , SalesChannelContext $ context ) : ? Tree { /** @var CategoryEntity $active */ $ active = $ this -> loadActive ( $ categoryId , $ context ) ; $ criteria = new Criteria ( ) ; $ criteria -> addFilter ( new EqualsFilter ( 'visible' , true ) ) ; $ criteria -> addFilter ( new MultiFilter ( MultiFilter :: CONNECTION_OR , [ new EqualsFilter ( 'category.id' , $ categoryId ) , new EqualsFilter ( 'category.parentId' , $ categoryId ) , ] ) ) ; /** @var CategoryCollection $categories */ $ categories = $ this -> categoryRepository -> search ( $ criteria , $ context ) -> getEntities ( ) ; $ parentId = $ categories -> get ( $ categoryId ) -> getParentId ( ) ; return $ this -> getTree ( $ parentId , $ categories , $ active ) ; }
Returns the category tree level for the provided category id.

@throws InconsistentCriteriaIdsException
Returns the category tree level for the provided category id .