/**
  * @param int $idLocale
  *
  * @return array
  */
 protected function getCategoriesWithPaths($idLocale)
 {
     $categoryEntityList = $this->categoryQueryContainer->queryCategory($idLocale)->find();
     $categories = [];
     $pathCache = [];
     foreach ($categoryEntityList as $categoryEntity) {
         foreach ($categoryEntity->getNodes() as $nodeEntity) {
             if (!array_key_exists($nodeEntity->getFkParentCategoryNode(), $pathCache)) {
                 $path = $this->buildPath($nodeEntity);
             } else {
                 $path = $pathCache[$nodeEntity->getFkParentCategoryNode()];
             }
             $categories[$path][$nodeEntity->getIdCategoryNode()] = $categoryEntity->getLocalisedAttributes($idLocale)->getFirst()->getName();
         }
     }
     $categories = $this->sortCategoriesWithPaths($categories);
     return $categories;
 }