[Form] Remove deprecated code from Date & Time related fields
This commit is contained in:
parent
46efc9b4ac
commit
f8b0994b5d
@ -207,23 +207,10 @@ class DateTimeType extends AbstractType
|
||||
return $options['widget'];
|
||||
};
|
||||
|
||||
// BC until Symfony 2.3
|
||||
$modelTimezone = function (Options $options) {
|
||||
return $options['data_timezone'];
|
||||
};
|
||||
|
||||
// BC until Symfony 2.3
|
||||
$viewTimezone = function (Options $options) {
|
||||
return $options['user_timezone'];
|
||||
};
|
||||
|
||||
$resolver->setDefaults(array(
|
||||
'input' => 'datetime',
|
||||
'model_timezone' => $modelTimezone,
|
||||
'view_timezone' => $viewTimezone,
|
||||
// Deprecated timezone options
|
||||
'data_timezone' => null,
|
||||
'user_timezone' => null,
|
||||
'model_timezone' => null,
|
||||
'view_timezone' => null,
|
||||
'format' => self::HTML5_FORMAT,
|
||||
'date_format' => null,
|
||||
'widget' => null,
|
||||
|
@ -189,16 +189,6 @@ class DateType extends AbstractType
|
||||
return $options['widget'] === 'single_text' ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
|
||||
};
|
||||
|
||||
// BC until Symfony 2.3
|
||||
$modelTimezone = function (Options $options) {
|
||||
return $options['data_timezone'];
|
||||
};
|
||||
|
||||
// BC until Symfony 2.3
|
||||
$viewTimezone = function (Options $options) {
|
||||
return $options['user_timezone'];
|
||||
};
|
||||
|
||||
$resolver->setDefaults(array(
|
||||
'years' => range(date('Y') - 5, date('Y') + 5),
|
||||
'months' => range(1, 12),
|
||||
@ -206,11 +196,8 @@ class DateType extends AbstractType
|
||||
'widget' => 'choice',
|
||||
'input' => 'datetime',
|
||||
'format' => $format,
|
||||
'model_timezone' => $modelTimezone,
|
||||
'view_timezone' => $viewTimezone,
|
||||
// Deprecated timezone options
|
||||
'data_timezone' => null,
|
||||
'user_timezone' => null,
|
||||
'model_timezone' => null,
|
||||
'view_timezone' => null,
|
||||
'empty_value' => $emptyValue,
|
||||
// Don't modify \DateTime classes by reference, we treat
|
||||
// them like immutable value objects
|
||||
|
@ -173,16 +173,6 @@ class TimeType extends AbstractType
|
||||
);
|
||||
};
|
||||
|
||||
// BC until Symfony 2.3
|
||||
$modelTimezone = function (Options $options) {
|
||||
return $options['data_timezone'];
|
||||
};
|
||||
|
||||
// BC until Symfony 2.3
|
||||
$viewTimezone = function (Options $options) {
|
||||
return $options['user_timezone'];
|
||||
};
|
||||
|
||||
$resolver->setDefaults(array(
|
||||
'hours' => range(0, 23),
|
||||
'minutes' => range(0, 59),
|
||||
@ -191,11 +181,8 @@ class TimeType extends AbstractType
|
||||
'input' => 'datetime',
|
||||
'with_minutes' => true,
|
||||
'with_seconds' => false,
|
||||
'model_timezone' => $modelTimezone,
|
||||
'view_timezone' => $viewTimezone,
|
||||
// Deprecated timezone options
|
||||
'data_timezone' => null,
|
||||
'user_timezone' => null,
|
||||
'model_timezone' => null,
|
||||
'view_timezone' => null,
|
||||
'empty_value' => $emptyValue,
|
||||
// Don't modify \DateTime classes by reference, we treat
|
||||
// them like immutable value objects
|
||||
|
@ -97,8 +97,8 @@ class DateTimeTypeTest extends LocalizedTestCase
|
||||
public function testSubmitWithoutMinutes()
|
||||
{
|
||||
$form = $this->factory->create('datetime', null, array(
|
||||
'data_timezone' => 'UTC',
|
||||
'user_timezone' => 'UTC',
|
||||
'model_timezone' => 'UTC',
|
||||
'view_timezone' => 'UTC',
|
||||
'date_widget' => 'choice',
|
||||
'time_widget' => 'choice',
|
||||
'input' => 'datetime',
|
||||
|
@ -114,8 +114,8 @@ class TimeTypeTest extends LocalizedTestCase
|
||||
public function testSubmitDatetimeSingleTextWithoutMinutes()
|
||||
{
|
||||
$form = $this->factory->create('time', null, array(
|
||||
'data_timezone' => 'UTC',
|
||||
'user_timezone' => 'UTC',
|
||||
'model_timezone' => 'UTC',
|
||||
'view_timezone' => 'UTC',
|
||||
'input' => 'datetime',
|
||||
'widget' => 'single_text',
|
||||
'with_minutes' => false,
|
||||
@ -150,8 +150,8 @@ class TimeTypeTest extends LocalizedTestCase
|
||||
public function testSubmitArraySingleTextWithoutMinutes()
|
||||
{
|
||||
$form = $this->factory->create('time', null, array(
|
||||
'data_timezone' => 'UTC',
|
||||
'user_timezone' => 'UTC',
|
||||
'model_timezone' => 'UTC',
|
||||
'view_timezone' => 'UTC',
|
||||
'input' => 'array',
|
||||
'widget' => 'single_text',
|
||||
'with_minutes' => false,
|
||||
@ -207,8 +207,8 @@ class TimeTypeTest extends LocalizedTestCase
|
||||
public function testSubmitStringSingleTextWithoutMinutes()
|
||||
{
|
||||
$form = $this->factory->create('time', null, array(
|
||||
'data_timezone' => 'UTC',
|
||||
'user_timezone' => 'UTC',
|
||||
'model_timezone' => 'UTC',
|
||||
'view_timezone' => 'UTC',
|
||||
'input' => 'string',
|
||||
'widget' => 'single_text',
|
||||
'with_minutes' => false,
|
||||
@ -223,8 +223,8 @@ class TimeTypeTest extends LocalizedTestCase
|
||||
public function testSetDataWithoutMinutes()
|
||||
{
|
||||
$form = $this->factory->create('time', null, array(
|
||||
'data_timezone' => 'UTC',
|
||||
'user_timezone' => 'UTC',
|
||||
'model_timezone' => 'UTC',
|
||||
'view_timezone' => 'UTC',
|
||||
'input' => 'datetime',
|
||||
'with_minutes' => false,
|
||||
));
|
||||
|
Reference in New Issue
Block a user