@@ -35,12 +35,12 @@ The package includes the following extractor classes: `CustomerExtractor`, `Invo
35
35
36
36
Extractor classes take 4 arguments:
37
37
38
- | name | description | type | default value |
39
- | ---------------| --------------------------------------------------------------------------------------------------| --------------------------| ---------------|
40
- | logger | the service that will log exceptions | \Psr\Log\LoggerInterface | |
41
- | client | client to choose depending on the Magento version. Available clients are: V2_1, V2_2, V2_3, V2_4 | Client | |
42
- | page size | (Optional) maximum amount of entities to retrieve in a single payload | int | 100 |
43
- | filter groups | (Optional) groups of filters to use when searching for entities | array | [ ] |
38
+ | name | description | type | default value |
39
+ | ------------------ | -- --------------------------------------------------------------------------------------------------| --------------------------| ---------------|
40
+ | logger | the service that will log exceptions | \Psr\Log\LoggerInterface | |
41
+ | client | client to choose depending on the Magento version. Available clients are: V2_1, V2_2, V2_3, V2_4 | Client | |
42
+ | query parameters | query parameters send to the api who contains groups of filters to use when searching for entities | array | [ ] |
43
+ | page size | (Optional) maximum amount of entities to retrieve in a single payload | int | 100 |
44
44
45
45
``` yaml
46
46
custom :
@@ -52,8 +52,8 @@ custom:
52
52
arguments :
53
53
- ' @Monolog\Logger' # Logger
54
54
- ' @Kiboko\Magento\V2_1\Client' # Client
55
+ - [] # QueryParameters, contains filters
55
56
- 500 # Page size
56
- - [] # Filter groups
57
57
58
58
Kiboko\Magento\V2_1\Client :
59
59
factory :
@@ -89,7 +89,7 @@ custom:
89
89
- 300 # Log level. 300 for Warning, 200 for Info...
90
90
` ` `
91
91
92
- #### With filters
92
+ #### With ScalarFilters
93
93
Filters and filter groups can be specified.
94
94
Filters in a group are chained with ` OR`. Groups are chained with `AND`.
95
95
@@ -101,18 +101,22 @@ In this example we will search for customers that were updated after 1985 (`@dat
101
101
arguments:
102
102
- '@Monolog\L ogger'
103
103
- '@Kiboko\M agento\V 2_1\C lient'
104
+ - '@query_parameters'
104
105
- 500
105
- - [ '@date_filter_group', '@id_filter_group' ]
106
- # updated_at >= 1985-10-26 11:25:00 AND (entity_id = 17 OR entity_id = 46)
107
106
108
107
# ...
109
108
109
+ query_parameters:
110
+ class: Kiboko\C omponent\F low\M agento2\Q ueryParameters
111
+ calls:
112
+ - withGroups: [ '@id_filter_group', '@date_filter_group' ]
113
+ # updated_at >= 1985-10-26 11:25:00 AND (entity_id = 17 OR entity_id = 46)
110
114
date_filter_group:
111
115
class: Kiboko\C omponent\F low\M agento2\F ilterGroup
112
116
calls:
113
117
- withFilter: [ '@last_execution' ]
114
118
last_execution:
115
- class: Kiboko\C omponent\F low\M agento2\F ilter
119
+ class: Kiboko\C omponent\F low\M agento2\F ilter\S calarFilter
116
120
arguments:
117
121
- 'updated_at'
118
122
- 'gteq'
@@ -123,48 +127,49 @@ In this example we will search for customers that were updated after 1985 (`@dat
123
127
calls:
124
128
- withFilter: [ '@id_to_check', '@other_id' ]
125
129
id_to_check:
126
- class: Kiboko\C omponent\F low\M agento2\F ilter
130
+ class: Kiboko\C omponent\F low\M agento2\F ilter\S calarFilter
127
131
arguments:
128
132
- 'entity_id'
129
133
- 'eq'
130
134
- '17'
131
135
other_id:
132
- class: Kiboko\C omponent\F low\M agento2\F ilter
136
+ class: Kiboko\C omponent\F low\M agento2\F ilter\S calarFilter
133
137
arguments:
134
138
- 'entity_id'
135
139
- 'eq'
136
140
- '46'
137
141
# ...
138
142
` ` `
139
143
140
- # ### With long filter
144
+ # ### With ArrayFilter
141
145
Filters are passed to the url.
142
146
But the most popular web browsers will not work with URLs over 2000 characters, and would return a 414 (Request-URI Too Long).
143
- You can use the method `withLongFilter ` to avoid this limitation and batch your request in multiple smaller requests.
147
+ You can use the class `ArrayFilter ` to avoid this limitation and batch your request in multiple smaller requests.
144
148
145
149
In this example we will search for specific orders with a lot of elements in the request's filter.
146
- We have 214 increment_id, and we use a `withLongFilter` with parameters :
147
- - ` @order_increment_id` references our order's filter.
148
- - ` offset` , starts the request at the chosen index, by default we have 0.
149
- - ` length` , defines a batch length, by default we have 200.
150
+ We have 214 increment_id, and we use the `ArrayFilter` with parameters :
151
+ - ` increment_id` field targeted by the filter.
152
+ - ` in` operator to the filter, you need the 'in' operator to use the ArrayFilter.
153
+ - ` 000000526,4000000026,00000918,000001754,6000000123,4000000150,6000000185,000003798,6000000211,[..],5000000445` defines the target values.
154
+ - ` 150` defines the lenght of your smaller request (by default set to 200).
150
155
151
- Here we have set an offset to 0 and a length to 150, it means we are starting the request from the first element and make multiple requests with 150 items max.
152
156
` ` ` yaml
153
157
# ...
154
- order_filter_group :
155
- class: Kiboko\C omponent\F low\M agento2\F ilterGroup
158
+ query_parameters :
159
+ class: Kiboko\C omponent\F low\M agento2\Q ueryParameters
156
160
calls:
157
- - withLongFilter : [ '@order_filter' ]
161
+ - withGroup : [ '@order_filter' ]
158
162
order_filter:
159
163
class: Kiboko\C omponent\F low\M agento2\F ilterGroup
160
164
calls:
161
- - withLongFilter : ['@order_increment_id', 0, 150 ]
165
+ - withFilter : ['@order_increment_id']
162
166
order_increment_id:
163
- class: Kiboko\C omponent\F low\M agento2\F ilter
167
+ class: Kiboko\C omponent\F low\M agento2\F ilter\A rrayFilter
164
168
arguments:
165
169
- 'increment_id'
166
170
- 'in'
167
171
- '000000526,4000000026,00000918,000001754,6000000123,4000000150,6000000185,000003798,6000000211,[..],5000000445'
172
+ - 150
168
173
# ...
169
174
` ` `
170
175
0 commit comments