[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'];
|
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(
|
$resolver->setDefaults(array(
|
||||||
'input' => 'datetime',
|
'input' => 'datetime',
|
||||||
'model_timezone' => $modelTimezone,
|
'model_timezone' => null,
|
||||||
'view_timezone' => $viewTimezone,
|
'view_timezone' => null,
|
||||||
// Deprecated timezone options
|
|
||||||
'data_timezone' => null,
|
|
||||||
'user_timezone' => null,
|
|
||||||
'format' => self::HTML5_FORMAT,
|
'format' => self::HTML5_FORMAT,
|
||||||
'date_format' => null,
|
'date_format' => null,
|
||||||
'widget' => null,
|
'widget' => null,
|
||||||
|
@ -189,16 +189,6 @@ class DateType extends AbstractType
|
|||||||
return $options['widget'] === 'single_text' ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
|
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(
|
$resolver->setDefaults(array(
|
||||||
'years' => range(date('Y') - 5, date('Y') + 5),
|
'years' => range(date('Y') - 5, date('Y') + 5),
|
||||||
'months' => range(1, 12),
|
'months' => range(1, 12),
|
||||||
@ -206,11 +196,8 @@ class DateType extends AbstractType
|
|||||||
'widget' => 'choice',
|
'widget' => 'choice',
|
||||||
'input' => 'datetime',
|
'input' => 'datetime',
|
||||||
'format' => $format,
|
'format' => $format,
|
||||||
'model_timezone' => $modelTimezone,
|
'model_timezone' => null,
|
||||||
'view_timezone' => $viewTimezone,
|
'view_timezone' => null,
|
||||||
// Deprecated timezone options
|
|
||||||
'data_timezone' => null,
|
|
||||||
'user_timezone' => null,
|
|
||||||
'empty_value' => $emptyValue,
|
'empty_value' => $emptyValue,
|
||||||
// Don't modify \DateTime classes by reference, we treat
|
// Don't modify \DateTime classes by reference, we treat
|
||||||
// them like immutable value objects
|
// 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(
|
$resolver->setDefaults(array(
|
||||||
'hours' => range(0, 23),
|
'hours' => range(0, 23),
|
||||||
'minutes' => range(0, 59),
|
'minutes' => range(0, 59),
|
||||||
@ -191,11 +181,8 @@ class TimeType extends AbstractType
|
|||||||
'input' => 'datetime',
|
'input' => 'datetime',
|
||||||
'with_minutes' => true,
|
'with_minutes' => true,
|
||||||
'with_seconds' => false,
|
'with_seconds' => false,
|
||||||
'model_timezone' => $modelTimezone,
|
'model_timezone' => null,
|
||||||
'view_timezone' => $viewTimezone,
|
'view_timezone' => null,
|
||||||
// Deprecated timezone options
|
|
||||||
'data_timezone' => null,
|
|
||||||
'user_timezone' => null,
|
|
||||||
'empty_value' => $emptyValue,
|
'empty_value' => $emptyValue,
|
||||||
// Don't modify \DateTime classes by reference, we treat
|
// Don't modify \DateTime classes by reference, we treat
|
||||||
// them like immutable value objects
|
// them like immutable value objects
|
||||||
|
@ -97,8 +97,8 @@ class DateTimeTypeTest extends LocalizedTestCase
|
|||||||
public function testSubmitWithoutMinutes()
|
public function testSubmitWithoutMinutes()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('datetime', null, array(
|
$form = $this->factory->create('datetime', null, array(
|
||||||
'data_timezone' => 'UTC',
|
'model_timezone' => 'UTC',
|
||||||
'user_timezone' => 'UTC',
|
'view_timezone' => 'UTC',
|
||||||
'date_widget' => 'choice',
|
'date_widget' => 'choice',
|
||||||
'time_widget' => 'choice',
|
'time_widget' => 'choice',
|
||||||
'input' => 'datetime',
|
'input' => 'datetime',
|
||||||
|
@ -114,8 +114,8 @@ class TimeTypeTest extends LocalizedTestCase
|
|||||||
public function testSubmitDatetimeSingleTextWithoutMinutes()
|
public function testSubmitDatetimeSingleTextWithoutMinutes()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('time', null, array(
|
$form = $this->factory->create('time', null, array(
|
||||||
'data_timezone' => 'UTC',
|
'model_timezone' => 'UTC',
|
||||||
'user_timezone' => 'UTC',
|
'view_timezone' => 'UTC',
|
||||||
'input' => 'datetime',
|
'input' => 'datetime',
|
||||||
'widget' => 'single_text',
|
'widget' => 'single_text',
|
||||||
'with_minutes' => false,
|
'with_minutes' => false,
|
||||||
@ -150,8 +150,8 @@ class TimeTypeTest extends LocalizedTestCase
|
|||||||
public function testSubmitArraySingleTextWithoutMinutes()
|
public function testSubmitArraySingleTextWithoutMinutes()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('time', null, array(
|
$form = $this->factory->create('time', null, array(
|
||||||
'data_timezone' => 'UTC',
|
'model_timezone' => 'UTC',
|
||||||
'user_timezone' => 'UTC',
|
'view_timezone' => 'UTC',
|
||||||
'input' => 'array',
|
'input' => 'array',
|
||||||
'widget' => 'single_text',
|
'widget' => 'single_text',
|
||||||
'with_minutes' => false,
|
'with_minutes' => false,
|
||||||
@ -207,8 +207,8 @@ class TimeTypeTest extends LocalizedTestCase
|
|||||||
public function testSubmitStringSingleTextWithoutMinutes()
|
public function testSubmitStringSingleTextWithoutMinutes()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('time', null, array(
|
$form = $this->factory->create('time', null, array(
|
||||||
'data_timezone' => 'UTC',
|
'model_timezone' => 'UTC',
|
||||||
'user_timezone' => 'UTC',
|
'view_timezone' => 'UTC',
|
||||||
'input' => 'string',
|
'input' => 'string',
|
||||||
'widget' => 'single_text',
|
'widget' => 'single_text',
|
||||||
'with_minutes' => false,
|
'with_minutes' => false,
|
||||||
@ -223,8 +223,8 @@ class TimeTypeTest extends LocalizedTestCase
|
|||||||
public function testSetDataWithoutMinutes()
|
public function testSetDataWithoutMinutes()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('time', null, array(
|
$form = $this->factory->create('time', null, array(
|
||||||
'data_timezone' => 'UTC',
|
'model_timezone' => 'UTC',
|
||||||
'user_timezone' => 'UTC',
|
'view_timezone' => 'UTC',
|
||||||
'input' => 'datetime',
|
'input' => 'datetime',
|
||||||
'with_minutes' => false,
|
'with_minutes' => false,
|
||||||
));
|
));
|
||||||
|
Reference in New Issue
Block a user