$this->
validate($activeId,
$active['path'
],
$context);
$isChild =
$this->
isChildCategory($activeId,
$active['path'
],
$rootId);
// If the provided activeId is not part of the rootId, a fallback to the rootId must be made here.
// The passed activeId is therefore part of another navigation and must therefore not be loaded.
// The availability validation has already been done in the `validate` function.
if (!
$isChild) { $activeId =
$rootId;
} $categories =
new CategoryCollection();
if ($depth > 0
) { // Load the first two levels without using the activeId in the query
$categories =
$this->
loadLevels($rootId,
(int) $root['level'
],
$context,
clone $criteria,
$depth);
} // If the active category is part of the provided root id, we have to load the children and the parents of the active id
$categories =
$this->
loadChildren($activeId,
$context,
$rootId,
$metaInfo,
$categories,
clone $criteria);
return new NavigationRouteResponse($categories);
}