Skip to content

Commit 70ecd37

Browse files
committed
MC-39836: CategoryFilterInput(parent_id) has to accept parent_uid and UIDS as input
- restore category uid processor
1 parent b91bfc7 commit 70ecd37

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

app/code/Magento/CatalogGraphQl/Model/Resolver/Products/Query/CategoryUidArgsProcessor.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
use Magento\Framework\GraphQl\Query\Resolver\ArgumentsProcessorInterface;
1313

1414
/**
15-
* Parent category UID processor class for category uid and category id arguments
15+
* Category UID processor class for category uid and category id arguments
1616
*/
17-
class ParentCategoryUidArgsProcessor implements ArgumentsProcessorInterface
17+
class CategoryUidArgsProcessor implements ArgumentsProcessorInterface
1818
{
19-
private const ID = 'parent_id';
19+
private const ID = 'category_id';
2020

21-
private const UID = 'parent_uid';
21+
private const UID = 'category_uid';
2222

2323
/** @var Uid */
2424
private $uidEncoder;
@@ -43,19 +43,19 @@ public function process(
4343
string $fieldName,
4444
array $args
4545
): array {
46-
$parentUidFilter = $args['filter'][self::UID] ?? [];
47-
$parentIdFilter = $args['filter'][self::ID] ?? [];
48-
if (!empty($parentIdFilter)
49-
&& !empty($parentUidFilter)
46+
$idFilter = $args['filter'][self::ID] ?? [];
47+
$uidFilter = $args['filter'][self::UID] ?? [];
48+
if (!empty($idFilter)
49+
&& !empty($uidFilter)
5050
&& $fieldName === 'products') {
5151
throw new GraphQlInputException(
5252
__('`%1` and `%2` can\'t be used at the same time.', [self::ID, self::UID])
5353
);
54-
} elseif (!empty($parentUidFilter)) {
55-
if (isset($parentUidFilter['eq'])) {
56-
$args['filter'][self::ID]['eq'] = $this->uidEncoder->decode((string) $parentUidFilter['eq']);
57-
} elseif (!empty($parentUidFilter['in'])) {
58-
foreach ($parentUidFilter['in'] as $uid) {
54+
} elseif (!empty($uidFilter)) {
55+
if (isset($uidFilter['eq'])) {
56+
$args['filter'][self::ID]['eq'] = $this->uidEncoder->decode((string) $uidFilter['eq']);
57+
} elseif (!empty($uidFilter['in'])) {
58+
foreach ($uidFilter['in'] as $uid) {
5959
$args['filter'][self::ID]['in'][] = $this->uidEncoder->decode((string) $uid);
6060
}
6161
}

0 commit comments

Comments
 (0)