Skip to content

Commit 0ba4b71

Browse files
committed
replace hardcode category root id number with Category THE_ROOT_ID const
1 parent 10afe1d commit 0ba4b71

File tree

1 file changed

+2
-1
lines changed
  • app/code/Magento/CatalogGraphQl/Model/Resolver/Products/DataProvider

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Magento\Catalog\Model\ResourceModel\Category\Collection;
1818
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
1919
use Magento\CatalogGraphQl\Model\AttributesJoiner;
20+
use Magento\Catalog\Model\Category;
2021

2122
/**
2223
* Category tree data provider
@@ -96,7 +97,7 @@ public function getTree(ResolveInfo $resolveInfo, int $rootCategoryId) : array
9697
$level = $this->levelCalculator->calculate($rootCategoryId);
9798

9899
// If root category is being filter, we've to remove first slash
99-
if ($rootCategoryId == 1) {
100+
if ($rootCategoryId == Category::TREE_ROOT_ID) {
100101
$regExpPathFilter = sprintf('.*%s/[/0-9]*$', $rootCategoryId);
101102
} else {
102103
$regExpPathFilter = sprintf('.*/%s/[/0-9]*$', $rootCategoryId);

0 commit comments

Comments
 (0)