Skip to content

Commit 105bea2

Browse files
committed
Revert "fix: only display hydra:next when the item total is strictly greater than the number of items per page (#3967)"
This reverts commit 9cecfab.
1 parent 2edb3bf commit 105bea2

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Hydra/Serializer/PartialCollectionViewNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function normalize($object, $format = null, array $context = [])
113113
$data['hydra:view']['hydra:previous'] = IriHelper::createIri($parsed['parts'], $parsed['parameters'], $this->pageParameterName, $currentPage - 1.);
114114
}
115115

116-
if (null !== $lastPage && $currentPage < $lastPage || null === $lastPage && $pageTotalItems > $itemsPerPage) {
116+
if (null !== $lastPage && $currentPage < $lastPage || null === $lastPage && $pageTotalItems >= $itemsPerPage) {
117117
$data['hydra:view']['hydra:next'] = IriHelper::createIri($parsed['parts'], $parsed['parameters'], $this->pageParameterName, $currentPage + 1.);
118118
}
119119
}

tests/Hydra/Serializer/PartialCollectionViewNormalizerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public function testNormalizePartialPaginator()
7979
'@id' => '/?_page=3',
8080
'@type' => 'hydra:PartialCollectionView',
8181
'hydra:previous' => '/?_page=2',
82+
'hydra:next' => '/?_page=4',
8283
],
8384
],
8485
$this->normalizePaginator(true)

0 commit comments

Comments
 (0)