diff --git a/packages/mango/HttpKernel/DtoInitializerValueResolver.php b/packages/mango/HttpKernel/DtoInitializerValueResolver.php index edd089d..1a8e365 100644 --- a/packages/mango/HttpKernel/DtoInitializerValueResolver.php +++ b/packages/mango/HttpKernel/DtoInitializerValueResolver.php @@ -45,9 +45,11 @@ public function resolve(Request $request, ArgumentMetadata $argument): iterable $objectToPopulate = $initializer(...$arguments); + $serializationContext = $request->attributes->get('denormalization_context', []) + [AbstractObjectNormalizer::OBJECT_TO_POPULATE => $objectToPopulate]; + $attribute = null === $objectToPopulate ? $attribute : new MapRequestPayload( $attribute->acceptFormat, - $attribute->serializationContext + [AbstractObjectNormalizer::OBJECT_TO_POPULATE => $objectToPopulate], + $attribute->serializationContext + $serializationContext, $attribute->validationGroups, );