G
G
grabbee2021-02-22 17:08:16
symfony
grabbee, 2021-02-22 17:08:16

API-Platform - is there a way to limit the selection on a one-to-many relationship?

If you choose the resource itself, then it has a selection limit (number of records / pagination). But when this resource has a connection to another [one-to-many] - then all available records are selected.

How to set a limit on the number of selected records by link in API-Platform

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daniil Vasilyev, 2021-02-22
@hello_my_name_is_dany

It's easier to make a call on the page with the API without getting the Platform (if you want, you can do an aggregation for the count). And already with the second request to get Platforms to this API with its pagination, if you need to get their list to it.

S
sanya misharin, 2021-02-23
@sanya_misharin

In the platform API, as well as in the symphony itself, there is an annotation MaxDepth for these purposes, more details here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question