You are here

private function Serializer::denormalizeObject in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/serializer/Serializer.php \Symfony\Component\Serializer\Serializer::denormalizeObject()

Denormalizes data back into an object of the given class.

Parameters

mixed $data data to restore:

string $class the expected class to instantiate:

string $format format name, present to give the option to normalizers to act differently based on formats:

array $context The context data for this particular denormalization:

Return value

object

Throws

LogicException

UnexpectedValueException

1 call to Serializer::denormalizeObject()
Serializer::denormalize in vendor/symfony/serializer/Serializer.php
Denormalizes data back into an object of the given class.

File

vendor/symfony/serializer/Serializer.php, line 283

Class

Serializer
Serializer serializes and deserializes data.

Namespace

Symfony\Component\Serializer

Code

private function denormalizeObject($data, $class, $format, array $context = array()) {
  if (!$this->normalizers) {
    throw new LogicException('You must register at least one normalizer to be able to denormalize objects.');
  }
  if ($normalizer = $this
    ->getDenormalizer($data, $class, $format)) {
    return $normalizer
      ->denormalize($data, $class, $format, $context);
  }
  throw new UnexpectedValueException(sprintf('Could not denormalize object of type %s, no supporting normalizer found.', $class));
}