private function getCategoryTree(string $navigationId, SalesChannelContext $context)
    {
        /** @var Tree $category */
        $category = $this->navigationLoader->loadLevel($navigationId, $context);

        /** @var CategoryEntity $active */
        $active = $category->getActive();

        if ($active->getChildCount() > 0 || $active->getParentId() === null) {
            return $category;
        }

        return $this->navigationLoader->loadLevel($active->getParentId(), $context);
    }
private function getCategoryTree(string $navigationId, SalesChannelContext $context)
    {
        /** @var Tree $category */
        $category = $this->navigationLoader->loadLevel($navigationId, $context);

        /** @var CategoryEntity $active */
        $active = $category->getActive();

        if ($active->getChildCount() > 0 || $active->getParentId() === null) {
            return $category;
        }

        return $this->navigationLoader->loadLevel($active->getParentId(), $context);
    }
private function getCategoryTree ( string $ navigationId , SalesChannelContext $ context ) { /** @var Tree $category */ $ category = $ this -> navigationLoader -> loadLevel ( $ navigationId , $ context ) ; /** @var CategoryEntity $active */ $ active = $ category -> getActive ( ) ; if ( $ active -> getChildCount ( ) > 0 || $ active -> getParentId ( ) === null ) { return $ category ; } return $ this -> navigationLoader -> loadLevel ( $ active -> getParentId ( ) , $ context ) ; }
returns the category tree for the passed
navigation id
if the category has no children,
the parent category will be used
returns the category tree for the passed navigation id if the category has no children the parent category will be used