You are here

public function ComplexDataNormalizer::normalize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/serialization/src/Normalizer/ComplexDataNormalizer.php \Drupal\serialization\Normalizer\ComplexDataNormalizer::normalize()

Normalizes an object into a set of arrays/scalars.

Parameters

object $object object to normalize:

string $format format the normalization result will be encoded as:

array $context Context options for the normalizer:

Return value

array|string|bool|int|float|null

Overrides NormalizerInterface::normalize

1 call to ComplexDataNormalizer::normalize()
EntityReferenceFieldItemNormalizer::normalize in core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizer.php
Normalizes an object into a set of arrays/scalars.
3 methods override ComplexDataNormalizer::normalize()
ConfigEntityNormalizer::normalize in core/modules/serialization/src/Normalizer/ConfigEntityNormalizer.php
Normalizes an object into a set of arrays/scalars.
ContentEntityNormalizer::normalize in core/modules/serialization/src/Normalizer/ContentEntityNormalizer.php
Normalizes an object into a set of arrays/scalars.
EntityReferenceFieldItemNormalizer::normalize in core/modules/serialization/src/Normalizer/EntityReferenceFieldItemNormalizer.php
Normalizes an object into a set of arrays/scalars.

File

core/modules/serialization/src/Normalizer/ComplexDataNormalizer.php, line 32
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, $context);
  }
  return $attributes;
}