elseif ('timestamp' ===
$options['input'
]) { $builder->
addModelTransformer(new ReversedTransformer( new DateTimeToTimestampTransformer($options['model_timezone'
],
$options['model_timezone'
]) ));
} elseif ('array' ===
$options['input'
]) { $builder->
addModelTransformer(new ReversedTransformer( new DateTimeToArrayTransformer($options['model_timezone'
],
$options['model_timezone'
],
['year', 'month', 'day'
]) ));
} if (\
in_array($options['input'
],
['datetime', 'datetime_immutable'
], true
) && null !==
$options['model_timezone'
]) { $builder->
addEventListener(FormEvents::POST_SET_DATA,
static function DFormEvent
$event) use ($options): void
{ $date =
$event->
getData();
if (!
$date instanceof \DateTimeInterface
) { return;
} if ($date->
getTimezone()->
getName() !==
$options['model_timezone'
]) { trigger_deprecation('symfony/form', '6.4',
sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is deprecated.',
$date::
class,
$date->
getTimezone()->
getName(),
$options['model_timezone'
]));
// throw new LogicException(sprintf('Using a "%s" instance with a timezone ("%s") not matching the configured model timezone "%s" is not supported.', $date::class, $date->getTimezone()->getName(), $options['model_timezone']));
} });
}