Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 808 Bytes

File metadata and controls

32 lines (25 loc) · 808 Bytes

Pagination

Cursor-based pagination is supported via the paginate() method on the Query Builder.

$page = $repository->createQueryBuilder()
    ->paginate()
    ->limit(10)
    ->getQuery()
    ->getResult(); // returns PaginatedResult<Task>

// Navigate pages
$page->items;           // Task[]
$page->hasNextPage;     // bool
$page->hasPreviousPage; // bool
$page->endCursor;       // string|null

$nextPage = $page->next();     // PaginatedResult<Task>|null
$prevPage = $page->previous(); // PaginatedResult<Task>|null

To start from a specific cursor:

$page = $repository->createQueryBuilder()
    ->paginate(after: 'cursor-string')
    ->limit(10)
    ->getQuery()
    ->getResult();

Pagination support requires a compatible GraphQL dialect. See dialects.md.