core/modules/hal/hal.services.yml | 4 +++- core/modules/hal/src/Normalizer/TimestampItemNormalizer.php | 10 ++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/modules/hal/hal.services.yml b/core/modules/hal/hal.services.yml index 66cf5ba..b2c898f 100644 --- a/core/modules/hal/hal.services.yml +++ b/core/modules/hal/hal.services.yml @@ -19,7 +19,9 @@ services: arguments: ['@entity.manager', '@http_client', '@hal.link_manager', '@module_handler'] serializer.normalizer.timestamp_item.hal: class: Drupal\hal\Normalizer\TimestampItemNormalizer - deprecated: The "%service_id% service is deprecated in 8.5.0, use the serializer.normalizer.timestamp service instead. + tags: + # Priority must be higher than serializer.normalizer.field_item.hal. + - { name: normalizer, priority: 20, bc: bc_timestamp_normalizer_unix, bc_config_name: 'serialization.settings' } serializer.normalizer.entity.hal: class: Drupal\hal\Normalizer\ContentEntityNormalizer arguments: ['@hal.link_manager', '@entity.manager', '@module_handler'] diff --git a/core/modules/hal/src/Normalizer/TimestampItemNormalizer.php b/core/modules/hal/src/Normalizer/TimestampItemNormalizer.php index 78ec5a3..be1a765 100644 --- a/core/modules/hal/src/Normalizer/TimestampItemNormalizer.php +++ b/core/modules/hal/src/Normalizer/TimestampItemNormalizer.php @@ -4,17 +4,16 @@ use Drupal\Core\Field\FieldItemInterface; use Drupal\Core\Field\Plugin\Field\FieldType\TimestampItem; +use Drupal\Core\TypedData\Plugin\DataType\Timestamp; use Drupal\serialization\Normalizer\TimeStampItemNormalizerTrait; /** * Converts values for TimestampItem to and from common formats for hal. * - * @deprecated in 8.5.0, use \Drupal\serialization\Normalizer\TimestampNormalizer instead. + * Overrides FieldItemNormalizer to use\Drupal\serialization\Normalizer\TimestampNormalizer */ class TimestampItemNormalizer extends FieldItemNormalizer { - use TimeStampItemNormalizerTrait; - /** * The interface or class that this Normalizer supports. * @@ -25,9 +24,8 @@ class TimestampItemNormalizer extends FieldItemNormalizer { /** * {@inheritdoc} */ - protected function normalizedFieldValues(FieldItemInterface $field_item, $format, array $context) { - $normalized = parent::normalizedFieldValues($field_item, $format, $context); - return $this->processNormalizedValues($normalized); + protected function constructValue($data, $context) { + return $this->serializer->denormalize($data, Timestamp::class, NULL, $context); } }