Skip to content

Commit dabe37b

Browse files
committed
Fix previous commit
1 parent 647370a commit dabe37b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Serializer.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,17 @@ private function addToMap(Context $context): array
6363
foreach ($context->endpoints($collection) as $endpoint) {
6464
if ($endpoint instanceof ProvidesResourceLinks) {
6565
foreach ($endpoint->resourceLinks($collectionContext) as $field) {
66-
$linkFieldsCache[$type][$field->name] ??= [
67-
$field,
68-
$collectionContext,
69-
];
66+
$linkFieldsCache[$type][$field->name] ??= [$field, $collection];
7067
}
7168
}
7269
}
7370
}
7471
}
7572

76-
foreach ($linkFieldsCache[$type] ?? [] as [$field, $collectionContext]) {
77-
if (!$field->isVisible($linkContext = $collectionContext->withField($field))) {
73+
foreach ($linkFieldsCache[$type] ?? [] as [$field, $collection]) {
74+
$linkContext = $context->withCollection($collection)->withField($field);
75+
76+
if (!$field->isVisible($linkContext)) {
7877
continue;
7978
}
8079

0 commit comments

Comments
 (0)