Skip to content

Commit 659e90a

Browse files
authored
Merge pull request #226 from api-platform/dunglas-serialization-groups
Test if groups are defined before updating them
2 parents b55d1b9 + 79bfc64 commit 659e90a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/serialization-groups-and-relations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ final class BookContextBuilder implements SerializerContextBuilderInterface
334334
$context = $this->decorated->createFromRequest($request, $normalization, $extractedAttributes);
335335
$subject = $request->attributes->get('data');
336336

337-
if ($subject instanceof Book && $this->authorizationChecker->isGranted('ROLE_ADMIN') && false === $normalization) {
337+
if ($subject instanceof Book && isset($context['groups']) && $this->authorizationChecker->isGranted('ROLE_ADMIN') && false === $normalization) {
338338
$context['groups'][] = 'admin_input';
339339
}
340340

0 commit comments

Comments
 (0)