FieldableEntityNormalizerTrait
trait FieldableEntityNormalizerTrait (View source)
A trait for providing fieldable entity normalization/denormalization methods.
Properties
| protected EntityFieldManagerInterface | $entityFieldManager | The entity field manager. |
|
| protected EntityTypeManagerInterface | $entityTypeManager | The entity type manager. |
|
| protected EntityTypeRepositoryInterface | $entityTypeRepository | The entity type repository. |
Methods
Determines the entity type ID to denormalize as.
Gets the entity type definition.
Denormalizes the bundle property so entity creation can use it.
Denormalizes entity data by denormalizing each field individually.
Returns the entity type repository.
Returns the entity field manager.
Returns the entity type manager.
Build the field item value using the incoming data.
Details
protected string
determineEntityTypeId(string $class, array $context)
Determines the entity type ID to denormalize as.
protected EntityTypeInterface
getEntityTypeDefinition(string $entity_type_id)
Gets the entity type definition.
protected string
extractBundleData(array $data, EntityTypeInterface $entity_type_definition)
Denormalizes the bundle property so entity creation can use it.
protected
denormalizeFieldData(array $data, FieldableEntityInterface $entity, string $format, array $context)
Denormalizes entity data by denormalizing each field individually.
protected EntityTypeRepositoryInterface
getEntityTypeRepository()
Returns the entity type repository.
protected EntityFieldManagerInterface
getEntityFieldManager()
Returns the entity field manager.
protected EntityTypeManagerInterface
getEntityTypeManager()
Returns the entity type manager.
protected mixed
constructValue(mixed $data, array $context)
Build the field item value using the incoming data.
Most normalizers that extend this class can simply use this method to construct the denormalized value without having to override denormalize() and reimplementing its validation logic or its call to set the field value.
It's recommended to not override this and instead provide a (de)normalizer at the DataType level.