function ResourceIdentifierNormalizer::normalize
Same name in other branches
- 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()
- 11.x core/modules/jsonapi/src/Normalizer/ResourceIdentifierNormalizer.php \Drupal\jsonapi\Normalizer\ResourceIdentifierNormalizer::normalize()
File
-
core/
modules/ jsonapi/ src/ Normalizer/ ResourceIdentifierNormalizer.php, line 51
Class
- ResourceIdentifierNormalizer
- Normalizes a Relationship according to the JSON:API specification.
Namespace
Drupal\jsonapi\NormalizerCode
public function normalize($object, $format = NULL, array $context = []) {
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.