Skip to content

Commit 6916492

Browse files
committed
Add a chapter on the long filter for magento plugin
1 parent d31d691 commit 6916492

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

content/connectivity/magento-2/_index.en.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,34 @@ In this example we will search for customers that were updated after 1985 (`@dat
137137
# ...
138138
```
139139

140+
#### With long filter
141+
Filters are passed on the url.
142+
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 requests.
144+
145+
In this example we will search for specifics orders with a lot of data, we have 214 increment_id, and we use a withLongFilter with parameters '@order_filter' (like the withFilter method), but we have 2 additional parameters who defines an offset and a lenght.
146+
The offset can help you to start the request at the chosen index, by default we have 0.
147+
The lenght help you to define a batch lenght, by default we have 200.
148+
Here we have defined an offset to 0 and a lenght to 150, it means we are starting the request to the first element and make multiple request with 150 items max.
149+
```yaml
150+
# ...
151+
order_filter_group:
152+
class: Kiboko\Component\Flow\Magento2\FilterGroup
153+
calls:
154+
- withLongFilter: [ '@order_filter' ]
155+
order_filter:
156+
class: Kiboko\Component\Flow\Magento2\FilterGroup
157+
calls:
158+
- withLongFilter: ['@order_increment_id', 0, 150]
159+
order_increment_id:
160+
class: Kiboko\Component\Flow\Magento2\Filter
161+
arguments:
162+
- 'increment_id'
163+
- 'in'
164+
- '000000526,4000000026,00000918,000001754,6000000123,4000000150,6000000185,000003798,6000000211,6000000230,000004664,000004950,6000000265,6000000293,000008038,000008842,6000000475,6000000494,6000000500,000012074,000012247,000012453,000012589,2000000159,000014903,6000000760,6000000776,000016545,4000000530,000016553,4000000531,000016567,000016593,000016623,000016631,000016636,000016642,000016646,000016649,000016662,000016684,000016687,000016690,000016700,000016706,000016731,000016743,000016751,000016755,000016770,000016771,000016775,000016782,000016805,000016820,000016826,000016832,000016836,000016837,000016839,000016841,000016842,000016843,000016845,000016849,000016851,000016852,000016858,000016859,000016862,000016863,000018513,6000000947,4000000604,000021935,000021938,000021944,000022086,000022515,000022582,000022613,000022682,000022998,000023200,000023201,000023202,000023203,6000001188,000023204,000023205,000023206,6000001189,000023207,000023208,000023209,000023210,000023211,000023212,000023213,000023216,000023218,000023219,000023220,000023221,6000001190,000023229,000023230,6000001191,000023232,000023236,6000001192,000023238,000023243,000023244,000023245,000023249,000023250,3000000086,23253,000023257,000023258,6000001194,6000001195,000023269,000023274,6000001196,000023287,000023292,000023294,000023297,000023299,000023300,000023312,000023319,000023320,000023322,000023324,000023325,000023326,000023327,000023328,000023331,6000001202,000023337,000023338,000023339,5000000362,000023340,000023341,000023342,000023343,000023345,000023346,000023347,000023349,000023350,000023352,000023355,000023360,000023376,000023396,000023451,000023465,000023466,000023469,000023470,000023472,5000000363,000023478,000023479,000023480,000023482,000023483,000023484,000023486,000023488,000023489,000023492,000023494,4000000654,000023498,000022925,000023506,000023507,000023510,6000001217,000023513,000023515,000023520,000023521,000023524,000023528,000023532,000023536,6000001316,000025518,000026204,6000001390,000026947,000026948,4000000734,000027673,000027772,000027936,000027990,6000001487,000028108,000028118,000028129,000028130,000028131,000028132,000028133,5000000445'
165+
# ...
166+
```
167+
140168
### Building a lookup
141169
There is a lookup class for Categories, and one for product Attributes.
142170

0 commit comments

Comments
 (0)