drop support for differing timezones without ref date
This commit is contained in:
parent
85016e85d1
commit
3dc6033f8b
@ -4,6 +4,8 @@ CHANGELOG
|
||||
5.0.0
|
||||
-----
|
||||
|
||||
* Removed support for using different values for the "model_timezone" and "view_timezone" options of the `TimeType`
|
||||
without configuring a reference date.
|
||||
* Removed the `scale` option of the `IntegerType`.
|
||||
* Using the `date_format`, `date_widget`, and `time_widget` options of the `DateTimeType` when the `widget` option is
|
||||
set to `single_text` is not supported anymore.
|
||||
|
@ -13,6 +13,7 @@ namespace Symfony\Component\Form\Extension\Core\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Exception\InvalidConfigurationException;
|
||||
use Symfony\Component\Form\Exception\LogicException;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeImmutableToDateTimeTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
|
||||
@ -309,12 +310,12 @@ class TimeType extends AbstractType
|
||||
'choice_translation_domain' => false,
|
||||
]);
|
||||
|
||||
$resolver->setDeprecated('model_timezone', function (Options $options, $modelTimezone): string {
|
||||
$resolver->setNormalizer('model_timezone', function (Options $options, $modelTimezone): ?string {
|
||||
if (null !== $modelTimezone && $options['view_timezone'] !== $modelTimezone && null === $options['reference_date']) {
|
||||
return sprintf('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is deprecated since Symfony 4.4.');
|
||||
throw new LogicException(sprintf('Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.'));
|
||||
}
|
||||
|
||||
return '';
|
||||
return $modelTimezone;
|
||||
});
|
||||
|
||||
$resolver->setNormalizer('placeholder', $placeholderNormalizer);
|
||||
|
@ -42,11 +42,6 @@ class DebugCommandTest extends TestCase
|
||||
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
||||
$this->assertSame(<<<TXT
|
||||
|
||||
Built-in form types (Symfony\Component\Form\Extension\Core\Type)
|
||||
----------------------------------------------------------------
|
||||
|
||||
TimeType
|
||||
|
||||
Service form types
|
||||
------------------
|
||||
|
||||
|
@ -426,8 +426,8 @@ class TimeTypeTest extends BaseTypeTest
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is deprecated since Symfony 4.4.
|
||||
* @expectedException \Symfony\Component\Form\Exception\LogicException
|
||||
* @expectedExceptionMessage Using different values for the "model_timezone" and "view_timezone" options without configuring a reference date is not supported.
|
||||
*/
|
||||
public function testSetDataDifferentTimezonesWithoutReferenceDate()
|
||||
{
|
||||
|
Reference in New Issue
Block a user