Skip to content

Commit cb22c2b

Browse files
committed
B2B-2469: Improve category children loading
- functional fixes
1 parent afae655 commit cb22c2b

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/CategoriesQuery.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
9898

9999
$rootCategoryIds = $filterResult['category_ids'] ?? [];
100100

101-
$filterResult['items'] = $this->fetchCategories($rootCategoryIds, $info, $store, $context);
101+
$filterResult['items'] = $this->fetchCategories($rootCategoryIds, $info, $context);
102102
return $filterResult;
103103
}
104104

@@ -107,22 +107,19 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
107107
*
108108
* @param array $categoryIds
109109
* @param ResolveInfo $info
110-
* @param StoreInterface $store
111110
* @param ContextInterface $context
112111
* @return array
113112
*/
114113
private function fetchCategories(
115114
array $categoryIds,
116115
ResolveInfo $info,
117-
StoreInterface $store,
118116
ContextInterface $context
119117
) {
120118
$searchCriteria = $this->searchCriteriaFactory->create();
121119
$categoryCollection = $this->categoryTree->getFlatCategoriesByRootIds(
122120
$info,
123121
$categoryIds,
124122
$searchCriteria,
125-
$store,
126123
[],
127124
$context
128125
);

app/code/Magento/CatalogGraphQl/Model/Resolver/CategoryList.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
9595
throw new GraphQlInputException(__($e->getMessage()));
9696
}
9797

98-
return $this->fetchCategoriesByTopLevelIds($topLevelCategoryIds, $info, $processedArgs, $store, [], $context);
98+
return $this->fetchCategoriesByTopLevelIds($topLevelCategoryIds, $info, $processedArgs, [], $context);
9999
}
100100

101101
/**
@@ -104,7 +104,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
104104
* @param array $topLevelCategoryIds
105105
* @param ResolveInfo $info
106106
* @param array $criteria
107-
* @param StoreInterface $store
108107
* @param array $attributeNames
109108
* @param ContextInterface $context
110109
* @return array
@@ -114,17 +113,18 @@ private function fetchCategoriesByTopLevelIds(
114113
array $topLevelCategoryIds,
115114
ResolveInfo $info,
116115
array $criteria,
117-
StoreInterface $store,
118116
array $attributeNames,
119-
$context
117+
ContextInterface $context
120118
) : array {
121119
$criteria['pageSize'] = 0;
122-
$searchCriteria = $this->searchCriteria->buildCriteria($criteria, $store);
120+
$searchCriteria = $this->searchCriteria->buildCriteria(
121+
$criteria,
122+
$context->getExtensionAttributes()->getStore()
123+
);
123124
$categoryCollection = $this->categoryTree->getFlatCategoriesByRootIds(
124125
$info,
125126
$topLevelCategoryIds,
126127
$searchCriteria,
127-
$store,
128128
$attributeNames,
129129
$context
130130
);

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/CategoryTree.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ public function getFlatCategoriesByRootIds(
154154
ResolveInfo $resolveInfo,
155155
array $topLevelCategoryIds,
156156
SearchCriteria $searchCriteria,
157-
StoreInterface $store,
158157
array $attributeNames,
159158
ContextInterface $context
160159
): Collection {

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider/CategoryTree/Wrapper/Node.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ public function getId(): int
9999
}
100100

101101
/**
102-
* Render node and its children as an array recursively.
103-
* Returns null is node model is not set.
102+
* Render node and its children as an array recursively, returns null is node model is not set.
104103
*
105104
* @return array|null
106105
*/

0 commit comments

Comments
 (0)