Skip to content

Commit bc0806b

Browse files
authored
Merge pull request #2717 from desmax/subresource-pagination-fix
Fix PartialCollectionViewNormalizer for subresources
2 parents 90f422f + 9c14a78 commit bc0806b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Hydra/Serializer/PartialCollectionViewNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function normalize($object, $format = null, array $context = [])
7777
}
7878

7979
$metadata = isset($context['resource_class']) && null !== $this->resourceMetadataFactory ? $this->resourceMetadataFactory->create($context['resource_class']) : null;
80-
$isPaginatedWithCursor = $paginated && null !== $metadata && null !== $cursorPaginationAttribute = $metadata->getCollectionOperationAttribute($context['collection_operation_name'], 'pagination_via_cursor', null, true);
80+
$isPaginatedWithCursor = $paginated && null !== $metadata && null !== $cursorPaginationAttribute = $metadata->getCollectionOperationAttribute($context['collection_operation_name'] ?? $context['subresource_operation_name'], 'pagination_via_cursor', null, true);
8181

8282
$data['hydra:view'] = [
8383
'@id' => IriHelper::createIri($parsed['parts'], $parsed['parameters'], $this->pageParameterName, $paginated && !$isPaginatedWithCursor ? $currentPage : null),

0 commit comments

Comments
 (0)