public function ComplexDataNormalizer::normalize

Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize().

Overrides NormalizerInterface::normalize

File

drupal/core/modules/serialization/lib/Drupal/serialization/Normalizer/ComplexDataNormalizer.php, line 34
Contains \Drupal\serialization\Normalizer\ComplexDataNormalizer.

Class

ComplexDataNormalizer
Converts the Drupal entity object structures to a normalized array.

Namespace

Drupal\serialization\Normalizer

Code

public function normalize($object, $format = NULL, array $context = array()) {
  $attributes = array();
  foreach ($object as $name => $field) {
    $attributes[$name] = $this->serializer
      ->normalize($field, $format);
  }
  return $attributes;
}