Copied!

Normalizes an object implementing the {@see \DateTimeInterface} to a date string.

Denormalizes a date string to an instance of {@see \DateTime} or {@see \DateTimeImmutable}.

CloneableFinalInstantiable
Constants
public Symfony\Component\Serializer\Normalizer\DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS = 'collect_denormalization_errors'
public Symfony\Component\Serializer\Normalizer\DateTimeNormalizer::FORMAT_KEY = 'datetime_format'
public Symfony\Component\Serializer\Normalizer\DateTimeNormalizer::TIMEZONE_KEY = 'datetime_timezone'
Methods
public __construct(array $defaultContext = [])
public denormalize(?mixed $data, string $type, ?string $format = NULL, array $context = []) : DateTimeInterface
 
  • throws \NotNormalizableValueException
public getSupportedTypes(?string $format) : array
public normalize(?mixed $object, ?string $format = NULL, array $context = []) : string
 
  • throws \InvalidArgumentException
public setDefaultContext(array $defaultContext) : void
public supportsDenormalization(?mixed $data, string $type, ?string $format = NULL, array $context = []) : bool
public supportsNormalization(?mixed $data, ?string $format = NULL, array $context = []) : bool
Constants
private Symfony\Component\Serializer\Normalizer\DateTimeNormalizer::SUPPORTED_TYPES = ['DateTimeInterface' => true, 'DateTimeImmutable' => true, 'DateTime' => true]
Properties
private array $defaultContext = ['datetime_format' => 'Y-m-d\TH:i:sP', 'datetime_timezone' => NULL]
Methods
private formatDateTimeErrors(array $errors) : array
 

Formats datetime errors.

  • return string[]
private getTimezone(array $context) : ?DateTimeZone
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration