diff --git a/core/serialization-groups-and-relations.md b/core/serialization-groups-and-relations.md index 0db802f70ad..0e036f229fb 100644 --- a/core/serialization-groups-and-relations.md +++ b/core/serialization-groups-and-relations.md @@ -334,7 +334,7 @@ final class BookContextBuilder implements SerializerContextBuilderInterface $context = $this->decorated->createFromRequest($request, $normalization, $extractedAttributes); $subject = $request->attributes->get('data'); - if ($subject instanceof Book && $this->authorizationChecker->isGranted('ROLE_ADMIN') && false === $normalization) { + if ($subject instanceof Book && isset($context['groups']) && $this->authorizationChecker->isGranted('ROLE_ADMIN') && false === $normalization) { $context['groups'][] = 'admin_input'; }