Skip to content

Commit 0b2bdc6

Browse files
committed
magento/graphql-ce#463: Query category for disabled catalog with products returns the products count
1 parent af96830 commit 0b2bdc6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Category/CheckCategoryIsActive.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
namespace Magento\CatalogGraphQl\Model\Resolver\Category;
99

1010
use Magento\Catalog\Api\Data\CategoryInterface;
11-
use Magento\Catalog\Model\Category;
1211
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
1312
use Magento\Framework\EntityManager\MetadataPool;
1413
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
@@ -43,13 +42,13 @@ public function __construct(
4342
/**
4443
* Check if category is active.
4544
*
46-
* @param int $rootCategoryId
45+
* @param int $categoryId
4746
* @throws GraphQlNoSuchEntityException
4847
*/
49-
public function execute(int $rootCategoryId): void
48+
public function execute(int $categoryId): void
5049
{
5150
$collection = $this->collectionFactory->create();
52-
$collection->addAttributeToFilter(Category::KEY_IS_ACTIVE, ['eq' => 1])
51+
$collection->addAttributeToFilter(CategoryInterface::KEY_IS_ACTIVE, ['eq' => 1])
5352
->getSelect()
5453
->where(
5554
$collection->getSelect()
@@ -58,7 +57,7 @@ public function execute(int $rootCategoryId): void
5857
'e.' .
5958
$this->metadata->getMetadata(CategoryInterface::class)->getIdentifierField()
6059
) . ' = ?',
61-
$rootCategoryId
60+
$categoryId
6261
);
6362

6463
if ($collection->count() === 0) {

0 commit comments

Comments
 (0)