13
13
use Magento \Framework \GraphQl \Query \Resolver \ArgumentsProcessorInterface ;
14
14
15
15
/**
16
- * Category Path processor class for category uid and category id arguments
16
+ * Category Path processor class for category url path argument
17
17
*/
18
18
class CategoryUrlPathArgsProcessor implements ArgumentsProcessorInterface
19
19
{
20
20
private const ID = 'category_id ' ;
21
21
22
22
private const UID = 'category_uid ' ;
23
23
24
- private const PATH = 'category_url_path ' ;
24
+ private const URL_PATH = 'category_url_path ' ;
25
25
26
26
/**
27
27
* @var CollectionFactory
@@ -50,16 +50,16 @@ public function process(
50
50
): array {
51
51
$ idFilter = $ args ['filter ' ][self ::ID ] ?? [];
52
52
$ uidFilter = $ args ['filter ' ][self ::UID ] ?? [];
53
- $ pathFilter = $ args ['filter ' ][self ::PATH ] ?? [];
53
+ $ pathFilter = $ args ['filter ' ][self ::URL_PATH ] ?? [];
54
54
55
55
if (!empty ($ pathFilter ) && $ fieldName === 'products ' ) {
56
56
if (!empty ($ idFilter )) {
57
57
throw new GraphQlInputException (
58
- __ ('`%1` and `%2` can \'t be used at the same time. ' , [self ::ID , self ::PATH ])
58
+ __ ('`%1` and `%2` can \'t be used at the same time. ' , [self ::ID , self ::URL_PATH ])
59
59
);
60
60
} elseif (!empty ($ uidFilter )) {
61
61
throw new GraphQlInputException (
62
- __ ('`%1` and `%2` can \'t be used at the same time. ' , [self ::UID , self ::PATH ])
62
+ __ ('`%1` and `%2` can \'t be used at the same time. ' , [self ::UID , self ::URL_PATH ])
63
63
);
64
64
}
65
65
@@ -70,13 +70,13 @@ public function process(
70
70
71
71
if ($ collection ->count () === 0 ) {
72
72
throw new GraphQlInputException (
73
- __ ('No category with the provided `%1` was found ' , [' category_url_path ' ])
73
+ __ ('No category with the provided `%1` was found ' , [self :: URL_PATH ])
74
74
);
75
75
}
76
76
$ category = $ collection ->getFirstItem ();
77
77
$ args ['filter ' ][self ::ID ]['eq ' ] = $ category ->getId ();
78
78
79
- unset($ args ['filter ' ][self ::PATH ]);
79
+ unset($ args ['filter ' ][self ::URL_PATH ]);
80
80
}
81
81
return $ args ;
82
82
}
0 commit comments