function 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.