Skip to content

Commit

Permalink
[Serializer] Added the missed method
Browse files Browse the repository at this point in the history
  • Loading branch information
karser committed Dec 8, 2018
1 parent 7cf5ebe commit 8429361
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
Expand Up @@ -379,6 +379,25 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref
return new $class();
}

/**
* @internal
*/
protected function denormalizeParameter(\ReflectionClass $class, \ReflectionParameter $parameter, $parameterName, $parameterData, array $context, $format = null)
{
try {
if (null !== $parameter->getClass()) {
if (!$this->serializer instanceof DenormalizerInterface) {
throw new LogicException(sprintf('Cannot create an instance of %s from serialized data because the serializer inject in "%s" is not a denormalizer', $parameter->getClass(), static::class));
}
$parameterClass = $parameter->getClass()->getName();
return $this->serializer->denormalize($parameterData, $parameterClass, $format, $this->createChildContext($context, $parameterName));
}
return $parameterData;
} catch (\ReflectionException $e) {
throw new RuntimeException(sprintf('Could not determine the class of the parameter "%s".', $parameterName), 0, $e);
}
}

/**
* @param array $parentContext
* @param string $attribute
Expand Down

0 comments on commit 8429361

Please sign in to comment.