12
12
use Magento \Framework \GraphQl \Query \Resolver \ArgumentsProcessorInterface ;
13
13
14
14
/**
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
16
16
*/
17
- class ParentCategoryUidArgsProcessor implements ArgumentsProcessorInterface
17
+ class CategoryUidArgsProcessor implements ArgumentsProcessorInterface
18
18
{
19
- private const ID = 'parent_id ' ;
19
+ private const ID = 'category_id ' ;
20
20
21
- private const UID = 'parent_uid ' ;
21
+ private const UID = 'category_uid ' ;
22
22
23
23
/** @var Uid */
24
24
private $ uidEncoder ;
@@ -43,19 +43,19 @@ public function process(
43
43
string $ fieldName ,
44
44
array $ args
45
45
): 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 )
50
50
&& $ fieldName === 'products ' ) {
51
51
throw new GraphQlInputException (
52
52
__ ('`%1` and `%2` can \'t be used at the same time. ' , [self ::ID , self ::UID ])
53
53
);
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 ) {
59
59
$ args ['filter ' ][self ::ID ]['in ' ][] = $ this ->uidEncoder ->decode ((string ) $ uid );
60
60
}
61
61
}
0 commit comments