Skip to content

Add disable pagination for specific operation #1700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions core/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,59 @@ App\Entity\Book:
```
[/codeSelector]

### Disabling the Pagination For a Specific Operation

You can also disable an operation for a specific operation:

[codeSelector]

```php
<?php
// api/src/Entity/Book.php
namespace App\Entity;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;

#[ApiResource(
operations: [
new GetCollection(
paginationEnabled: false
)
]
)]
class Book
{
// ...
}
```

```yaml
# api/config/api_platform/resources.yaml
App\Entity\Book:
operations:
ApiPlatform\Metadata\GetCollection:
paginationEnabled: false
```

```xml
<?xml version="1.0" encoding="UTF-8" ?>
<!-- api/config/api_platform/resources.xml -->

<resources xmlns="https://api-platform.com/schema/metadata/resources-3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0
https://api-platform.com/schema/metadata/resources-3.0.xsd">
<resource class="App\Entity\Book">
<operations>
<operation class="ApiPlatform\Metadata\GetCollection"
paginationEnabled="false" />
</operations>
</resource>
</resources>
```
[/codeSelector]

### Disabling the Pagination Client-side

#### Disabling the Pagination Client-side Globally
Expand Down