Converts the Drupal entity object structure to JSON-LD array structure.
Expanded class hierarchy of JsonldEntityNormalizer
class JsonldEntityNormalizer extends JsonldNormalizerBase {
/**
* Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize()
*/
public function normalize($entity, $format = NULL) {
$entityWrapper = new JsonldEntityWrapper($entity, $format, $this->serializer);
$attributes = $entityWrapper
->getProperties();
$attributes = array(
'@id' => $entityWrapper
->getId(),
) + $attributes;
return $attributes;
}
/**
* Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsNormalization()
*/
public function supportsNormalization($data, $format = NULL) {
// @todo Switch to EntityInterface once all entity types are converted to
// EntityNG.
return parent::supportsNormalization($data, $format) && $data instanceof EntityNG;
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JsonldEntityNormalizer:: |
public | function |
Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize() Overrides NormalizerInterface:: |
|
JsonldEntityNormalizer:: |
public | function |
Implements \Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsNormalization() Overrides JsonldNormalizerBase:: |
|
JsonldNormalizerBase:: |
protected static | property | The formats that this Normalizer supports. | |
SerializerAwareNormalizer:: |
protected | property | ||
SerializerAwareNormalizer:: |
public | function |
Sets the owning Serializer object Overrides SerializerAwareInterface:: |