EntityDenormalizerBase
abstract class EntityDenormalizerBase extends NormalizerBase implements DenormalizerInterface (View source)
| internal | JSON:API maintains no PHP API since its API is the HTTP API. This class may change at any time and this will break any dependencies on it. |
Converts the Drupal entity object to a JSON:API array structure.
Traits
Properties
| protected string|array | $supportedInterfaceOrClass | The interface or class that this Normalizer supports. |
from NormalizerBase |
| protected | $format | {@inheritdoc} | from NormalizerBase |
| protected ResourceTypeRepositoryInterface | $resourceTypeRepository | The JSON:API resource type repository. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
|
| protected EntityFieldManagerInterface | $fieldManager | The entity field manager. |
|
| protected FieldTypePluginManagerInterface | $pluginManager | The field plugin manager. |
Methods
{@inheritdoc}
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
Checks if the provided format is supported by this normalizer.
Rasterizes a value recursively.
Constructs an EntityDenormalizerBase object.
{@inheritdoc}
{@inheritdoc}
Prepares the input data to create the entity.
Details
supportsNormalization($data, $format = NULL)
{@inheritdoc}
supportsDenormalization($data, $type, $format = NULL)
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()
This class doesn't implement DenormalizerInterface, but most of its child classes do. Therefore, this method is implemented at this level to reduce code duplication.
protected bool
checkFormat(string $format = NULL)
Checks if the provided format is supported by this normalizer.
protected
addCacheableDependency(array $context, $data)
Adds cacheability if applicable.
static protected mixed
rasterizeValueRecursive(mixed $value)
Rasterizes a value recursively.
This is mainly for configuration entities where a field can be a tree of values to rasterize.
__construct(EntityTypeManagerInterface $entity_type_manager, EntityFieldManagerInterface $field_manager, FieldTypePluginManagerInterface $plugin_manager)
Constructs an EntityDenormalizerBase object.
normalize($object, $format = NULL, array $context = [])
{@inheritdoc}
denormalize($data, $class, $format = NULL, array $context = [])
{@inheritdoc}
abstract protected array
prepareInput(array $data, ResourceType $resource_type, string $format, array $context)
Prepares the input data to create the entity.