File tree Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Expand file tree Collapse file tree 1 file changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,76 @@ class Book
205
205
}
206
206
` ` `
207
207
208
+ # # Partial pagination
209
+
210
+ When using the default pagination, a `COUNT` query will be issued against the current requested collection. This may have a
211
+ performance impact on really big collections. The downside is that the information about the last page is lost (ie : ` hydra:last` ).
212
+
213
+ # ## Globally
214
+
215
+ The partial pagination retrieval can be configured for all resources :
216
+
217
+ ` ` ` yaml
218
+ # app/config/config.yml
219
+
220
+ api_platform:
221
+ collection:
222
+ pagination:
223
+ partial: true # Disabled by default
224
+ ` ` `
225
+
226
+ # ## For a Specific Resource
227
+
228
+ ` ` ` php
229
+ <?php
230
+
231
+ // src/AppBundle/Entity/Book.php
232
+
233
+ use ApiPlatform\C ore\A nnotation\A piResource;
234
+
235
+ /**
236
+ * @ApiResource(attributes={"pagination_partial"=true})
237
+ */
238
+ class Book
239
+ {
240
+ // ...
241
+ }
242
+ ` ` `
243
+
244
+ # ## Client-side
245
+
246
+ # ### Globally
247
+
248
+ ` ` ` yaml
249
+ # app/config/config.yml
250
+
251
+ api_platform:
252
+ collection:
253
+ pagination:
254
+ client_partial: true # Disabled by default
255
+ partial_parameter_name: partial # Default value
256
+ ` ` `
257
+
258
+ The partial pagination retrieval can now be changed by toggling a query parameter named `partial` : ` GET /books?partial=true`
259
+
260
+ # ### For a Specific Resource
261
+
262
+ ` ` ` php
263
+ <?php
264
+
265
+ // src/AppBundle/Entity/Book.php
266
+
267
+ use ApiPlatform\C ore\A nnotation\A piResource;
268
+
269
+ /**
270
+ * @ApiResource(attributes={"pagination_client_partial"=true})
271
+ */
272
+ class Book
273
+ {
274
+ // ...
275
+ }
276
+ ` ` `
277
+
208
278
Previous chapter : [Validation](validation.md)
209
279
210
280
Next chapter : [The Event System](events.md)
You can’t perform that action at this time.
0 commit comments