Description
API Platform version(s) affected: 4.0.3
Description
I have a User Model, and the goal is to get all users (paginated) but also beeing able to order them. To archive this i added the following to my App\Models\User
:
#[ApiResource(
operations: [
new Get(),
new GetCollection(
parameters: [
new QueryParameter(key: 'order[:property]', filter: OrderFilter::class),
],
)
],
graphQlOperations: [
new Query(),
new QueryCollection(
parameters: [
new QueryParameter(key: 'order[:property]', filter: OrderFilter::class),
],
)
],
)]
Once i do that, pagination features are not working anymore in GraphQL (if i would also apply some custom query parameter to Query
or appy the filter globally, the filtering for id
would not work anymore). That is different behaviour to the REST Version the above code will produce the following in the REST Version:
As you can see, the pagination is still there. However in GraphQL, this will happen:
While the return type still is a user Cursor Connection, it is not possible to pass "first, after, etc..." pagination params. The reason for it is, that inside the FieldsBuilder
the $fieldConfiguration['args']
is only applied when there are no custom args/query parameters (here and here).