public function EntityReferenceNormalizer::normalize in Commerce Cart API 8
Overrides EntityReferenceFieldItemNormalizer::normalize
File
- src/
Normalizer/ EntityReferenceNormalizer.php, line 62
Class
- EntityReferenceNormalizer
- Expands entity reference field values to their referenced entity.
Namespace
Drupal\commerce_cart_api\NormalizerCode
public function normalize($field_item, $format = NULL, array $context = []) {
assert($field_item instanceof EntityReferenceItem);
$entity = $field_item
->get('entity')
->getValue();
return $this->serializer
->normalize($entity, $format, $context);
}