function ResourceIdentifierNormalizer::normalize
Same name in other branches
- 9 core/modules/jsonapi/src/Normalizer/ResourceIdentifierNormalizer.php \Drupal\jsonapi\Normalizer\ResourceIdentifierNormalizer::normalize()
- 8.9.x core/modules/jsonapi/src/Normalizer/ResourceIdentifierNormalizer.php \Drupal\jsonapi\Normalizer\ResourceIdentifierNormalizer::normalize()
- 10 core/modules/jsonapi/src/Normalizer/ResourceIdentifierNormalizer.php \Drupal\jsonapi\Normalizer\ResourceIdentifierNormalizer::normalize()
File
-
core/
modules/ jsonapi/ src/ Normalizer/ ResourceIdentifierNormalizer.php, line 46
Class
- ResourceIdentifierNormalizer
- Normalizes a Relationship according to the JSON:API specification.
Namespace
Drupal\jsonapi\NormalizerCode
public function normalize($object, $format = NULL, array $context = []) : array|string|int|float|bool|\ArrayObject|null {
assert($object instanceof ResourceIdentifier);
$normalization = [
'type' => $object->getTypeName(),
'id' => $object->getId(),
];
if ($object->getMeta()) {
$normalization['meta'] = $this->serializer
->normalize($object->getMeta(), $format, $context);
}
return CacheableNormalization::permanent($normalization);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.