function TimestampNormalizer::denormalize

Same name in other branches
  1. 9 core/modules/serialization/src/Normalizer/TimestampNormalizer.php \Drupal\serialization\Normalizer\TimestampNormalizer::denormalize()
  2. 8.9.x core/modules/serialization/src/Normalizer/TimestampNormalizer.php \Drupal\serialization\Normalizer\TimestampNormalizer::denormalize()
  3. 10 core/modules/serialization/src/Normalizer/TimestampNormalizer.php \Drupal\serialization\Normalizer\TimestampNormalizer::denormalize()

Overrides DateTimeNormalizer::denormalize

File

core/modules/serialization/src/Normalizer/TimestampNormalizer.php, line 37

Class

TimestampNormalizer
Converts values for the Timestamp data type to and from common formats.

Namespace

Drupal\serialization\Normalizer

Code

public function denormalize($data, $class, $format = NULL, array $context = []) : mixed {
    $denormalized = parent::denormalize($data, $class, $format, $context);
    return $denormalized->getTimestamp();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.