private function 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:

Return value

object

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

File

drupal/core/vendor/symfony/serializer/Symfony/Component/Serializer/Serializer.php, line 255

Class

Serializer
Serializer serializes and deserializes data

Namespace

Symfony\Component\Serializer

Code

private function denormalizeObject($data, $class, $format = null) {
  if (!$this->normalizers) {
    throw new LogicException('You must register at least one normalizer to be able to denormalize objects.');
  }
  if (isset($this->denormalizerCache[$class][$format])) {
    return $this->denormalizerCache[$class][$format]
      ->denormalize($data, $class, $format);
  }
  foreach ($this->normalizers as $normalizer) {
    if ($normalizer
      ->supportsDenormalization($data, $class, $format)) {
      $this->denormalizerCache[$class][$format] = $normalizer;
      return $normalizer
        ->denormalize($data, $class, $format);
    }
  }
  throw new UnexpectedValueException('Could not denormalize object of type ' . $class . ', no supporting normalizer found.');
}