• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 25668346367

11 May 2026 11:50AM UTC coverage: 26.549% (-2.1%) from 28.663%
25668346367

push

github

web-flow
fix(hydra): emit hydra:next and hydra:previous on empty cursor-paginated collections (#7961)

* fix(hydra): emit hydra:next and hydra:previous on empty cursor-paginated collections

When a cursor-paginated collection returns no items and the request URL
already contains a cursor filter (e.g. id[gt]=10), navigation links were
silently omitted because populateDataWithCursorBasedPagination() relies on
reading the first and last objects of the collection.

Synthesize the links from the URL parameters instead:
- hydra:next: invert the cursor operator (gt -> lt), keep the value
- hydra:previous: keep the operator, shift the value by items_per_page

If no cursor filter is present in the URL, the behavior is unchanged.

Fixes #7953

Signed-off-by: Guillaume Delré <delre.guillaume@gmail.com>

* test(hydra): add cursor pagination empty collection regression test

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Tickets       | refs #7953
| License       | MIT
| Doc PR        | ∅

Adds CursorPaginatedDummy fixture (canonical QueryParameter form with
ComparisonFilter + SortFilter) and a phpunit functional test asserting
hydra:next / hydra:previous on empty cursor-paginated collections.

graphQlOperations is disabled on the fixture: a latent bug in
FieldsBuilder.php:515 (ServiceLocator::has called with a FilterInterface
instance instead of a service id) crashes the GraphQL schema build when
an object-form filter is combined with a bracketed parameter key.

---------

Signed-off-by: Guillaume Delré <delre.guillaume@gmail.com>
Co-authored-by: soyuka <soyuka@users.noreply.github.com>

23 of 73 new or added lines in 2 files covered. (31.51%)

16976 of 63942 relevant lines covered (26.55%)

78.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

93.26
/src/Hydra/Serializer/PartialCollectionViewNormalizer.php


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc