deprecate some options for single_text widgets
This commit is contained in:
parent
5aa0967f9f
commit
89ff331865
@ -13,6 +13,12 @@ Config
|
|||||||
|
|
||||||
* Deprecated using environment variables with `cannotBeEmpty()` if the value is validated with `validate()`
|
* Deprecated using environment variables with `cannotBeEmpty()` if the value is validated with `validate()`
|
||||||
|
|
||||||
|
Form
|
||||||
|
----
|
||||||
|
|
||||||
|
* Using the `date_format`, `date_widget`, and `time_widget` options of the `DateTimeType` when the `widget` option is
|
||||||
|
set to `single_text` is deprecated.
|
||||||
|
|
||||||
FrameworkBundle
|
FrameworkBundle
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ Finder
|
|||||||
Form
|
Form
|
||||||
----
|
----
|
||||||
|
|
||||||
|
* 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.
|
||||||
* The `getExtendedType()` method was removed from the `FormTypeExtensionInterface`. It is replaced by the the static
|
* The `getExtendedType()` method was removed from the `FormTypeExtensionInterface`. It is replaced by the the static
|
||||||
`getExtendedTypes()` method which must return an iterable of extended types.
|
`getExtendedTypes()` method which must return an iterable of extended types.
|
||||||
|
|
||||||
|
@ -1602,6 +1602,9 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
*/
|
||||||
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
|
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', [
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', [
|
||||||
|
@ -4,6 +4,8 @@ CHANGELOG
|
|||||||
4.3.0
|
4.3.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
* deprecated using the `date_format`, `date_widget`, and `time_widget` options of the `DateTimeType` when the `widget`
|
||||||
|
option is set to `single_text`
|
||||||
* added `block_prefix` option to `BaseType`.
|
* added `block_prefix` option to `BaseType`.
|
||||||
|
|
||||||
4.2.0
|
4.2.0
|
||||||
|
@ -216,12 +216,12 @@ class DateTimeType extends AbstractType
|
|||||||
|
|
||||||
// Defaults to the value of "widget"
|
// Defaults to the value of "widget"
|
||||||
$dateWidget = function (Options $options) {
|
$dateWidget = function (Options $options) {
|
||||||
return $options['widget'];
|
return 'single_text' === $options['widget'] ? null : $options['widget'];
|
||||||
};
|
};
|
||||||
|
|
||||||
// Defaults to the value of "widget"
|
// Defaults to the value of "widget"
|
||||||
$timeWidget = function (Options $options) {
|
$timeWidget = function (Options $options) {
|
||||||
return $options['widget'];
|
return 'single_text' === $options['widget'] ? null : $options['widget'];
|
||||||
};
|
};
|
||||||
|
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
@ -292,6 +292,31 @@ class DateTimeType extends AbstractType
|
|||||||
'text',
|
'text',
|
||||||
'choice',
|
'choice',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$resolver->setDeprecated('date_format', function (Options $options, $dateFormat) {
|
||||||
|
if (null !== $dateFormat && 'single_text' === $options['widget']) {
|
||||||
|
return sprintf('Using the "date_format" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
||||||
|
//throw new LogicException(sprintf('Cannot use the "date_format" option of the %s when the "widget" option is set to "single_text".', self::class));
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
$resolver->setDeprecated('date_widget', function (Options $options, $dateWidget) {
|
||||||
|
if (null !== $dateWidget && 'single_text' === $options['widget']) {
|
||||||
|
return sprintf('Using the "date_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
||||||
|
//throw new LogicException(sprintf('Cannot use the "date_widget" option of the %s when the "widget" option is set to "single_text".', self::class));
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
$resolver->setDeprecated('time_widget', function (Options $options, $timeWidget) {
|
||||||
|
if (null !== $timeWidget && 'single_text' === $options['widget']) {
|
||||||
|
return sprintf('Using the "time_widget" option of %s when the "widget" option is set to "single_text" is deprecated since Symfony 4.3 and will lead to an exception in 5.0.', self::class);
|
||||||
|
//throw new LogicException(sprintf('Cannot use the "time_widget" option of the %s when the "widget" option is set to "single_text".', self::class));
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1506,6 +1506,9 @@ abstract class AbstractLayoutTest extends FormIntegrationTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
*/
|
||||||
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
|
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
|
||||||
{
|
{
|
||||||
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', [
|
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', [
|
||||||
|
@ -45,7 +45,7 @@ class DebugCommandTest extends TestCase
|
|||||||
Built-in form types (Symfony\Component\Form\Extension\Core\Type)
|
Built-in form types (Symfony\Component\Form\Extension\Core\Type)
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
IntegerType, TimezoneType
|
DateTimeType, IntegerType, TimezoneType
|
||||||
|
|
||||||
Service form types
|
Service form types
|
||||||
------------------
|
------------------
|
||||||
|
Reference in New Issue
Block a user