class ComplexDataNormalizer in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/serialization/src/Normalizer/ComplexDataNormalizer.php \Drupal\serialization\Normalizer\ComplexDataNormalizer
Converts the Drupal entity object structures to a normalized array.
This is the default Normalizer for entities. All formats that have Encoders registered with the Serializer in the DIC will be normalized with this class unless another Normalizer is registered which supersedes it. If a module wants to use format-specific or class-specific normalization, then that module can register a new Normalizer and give it a higher priority than this one.
Hierarchy
- class \Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer implements SerializerAwareInterface
- class \Drupal\serialization\Normalizer\NormalizerBase implements NormalizerInterface
- class \Drupal\serialization\Normalizer\ComplexDataNormalizer
- class \Drupal\serialization\Normalizer\NormalizerBase implements NormalizerInterface
Expanded class hierarchy of ComplexDataNormalizer
1 file declares its use of ComplexDataNormalizer
- ComplexDataNormalizerTest.php in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ ComplexDataNormalizerTest.php - Contains \Drupal\Tests\serialization\Unit\Normalizer\ComplexDataNormalizerTest.
1 string reference to 'ComplexDataNormalizer'
- serialization.services.yml in core/
modules/ serialization/ serialization.services.yml - core/modules/serialization/serialization.services.yml
1 service uses ComplexDataNormalizer
- serializer.normalizer.complex_data in core/
modules/ serialization/ serialization.services.yml - Drupal\serialization\Normalizer\ComplexDataNormalizer
File
- core/
modules/ serialization/ src/ Normalizer/ ComplexDataNormalizer.php, line 20 - Contains \Drupal\serialization\Normalizer\ComplexDataNormalizer.
Namespace
Drupal\serialization\NormalizerView source
class ComplexDataNormalizer extends NormalizerBase {
/**
* The interface or class that this Normalizer supports.
*
* @var string
*/
protected $supportedInterfaceOrClass = 'Drupal\\Core\\TypedData\\ComplexDataInterface';
/**
* {@inheritdoc}
*/
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;
}
}