public function Serializer::normalize in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/src/Serializer/Serializer.php \Drupal\jsonapi\Serializer\Serializer::normalize()
File
- core/
modules/ jsonapi/ src/ Serializer/ Serializer.php, line 60
Class
- Serializer
- Overrides the Symfony serializer to cordon off our incompatible normalizers.
Namespace
Drupal\jsonapi\SerializerCode
public function normalize($data, $format = NULL, array $context = []) {
if ($this
->selfSupportsNormalization($data, $format, $context)) {
return parent::normalize($data, $format, $context);
}
if ($this->fallbackNormalizer
->supportsNormalization($data, $format, $context)) {
return $this->fallbackNormalizer
->normalize($data, $format, $context);
}
return parent::normalize($data, $format, $context);
}