3 namespace Drupal\serialization\Normalizer;
6 * Converts the Drupal entity object structures to a normalized array.
8 * This is the default Normalizer for entities. All formats that have Encoders
9 * registered with the Serializer in the DIC will be normalized with this
10 * class unless another Normalizer is registered which supersedes it. If a
11 * module wants to use format-specific or class-specific normalization, then
12 * that module can register a new Normalizer and give it a higher priority than
15 class ComplexDataNormalizer extends NormalizerBase {
18 * The interface or class that this Normalizer supports.
22 protected $supportedInterfaceOrClass = 'Drupal\Core\TypedData\ComplexDataInterface';
27 public function normalize($object, $format = NULL, array $context = []) {
29 /** @var \Drupal\Core\TypedData\TypedDataInterface $field */
30 foreach ($object as $name => $field) {
31 $attributes[$name] = $this->serializer->normalize($field, $format, $context);