[Form] Deprecate TimezoneType regions option
This commit is contained in:
parent
a6e4d4abef
commit
5cb532d2de
@ -104,6 +104,8 @@ Form
|
||||
{% endfor %}
|
||||
```
|
||||
|
||||
* The `regions` option of the `TimezoneType` is deprecated.
|
||||
|
||||
HttpFoundation
|
||||
--------------
|
||||
|
||||
|
@ -121,6 +121,8 @@ Form
|
||||
{% endfor %}
|
||||
```
|
||||
|
||||
* The `regions` option was removed from the `TimezoneType`.
|
||||
|
||||
FrameworkBundle
|
||||
---------------
|
||||
|
||||
|
@ -40,6 +40,7 @@ CHANGELOG
|
||||
* added a cause when a CSRF error has occurred
|
||||
* deprecated the `scale` option of the `IntegerType`
|
||||
* removed restriction on allowed HTTP methods
|
||||
* deprecated the `regions` option of the `TimezoneType`
|
||||
|
||||
4.1.0
|
||||
-----
|
||||
|
@ -37,7 +37,7 @@ class TimezoneType extends AbstractType
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'choice_loader' => function (Options $options) {
|
||||
$regions = $options['regions'];
|
||||
$regions = $options->offsetGet('regions', false);
|
||||
|
||||
return new CallbackChoiceLoader(function () use ($regions) {
|
||||
return self::getTimezones($regions);
|
||||
@ -51,6 +51,7 @@ class TimezoneType extends AbstractType
|
||||
$resolver->setAllowedValues('input', array('string', 'datetimezone'));
|
||||
|
||||
$resolver->setAllowedTypes('regions', 'int');
|
||||
$resolver->setDeprecated('regions', 'The option "%name%" is deprecated since Symfony 4.2.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ class DebugCommandTest extends TestCase
|
||||
Built-in form types (Symfony\Component\Form\Extension\Core\Type)
|
||||
----------------------------------------------------------------
|
||||
|
||||
IntegerType
|
||||
IntegerType, TimezoneType
|
||||
|
||||
Service form types
|
||||
------------------
|
||||
|
@ -53,6 +53,10 @@ class TimezoneTypeTest extends BaseTypeTest
|
||||
$this->assertEquals(array(new \DateTimeZone('Europe/Amsterdam'), new \DateTimeZone('Europe/Paris')), $form->getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation The option "regions" is deprecated since Symfony 4.2.
|
||||
*/
|
||||
public function testFilterByRegions()
|
||||
{
|
||||
$choices = $this->factory->create(static::TESTED_TYPE, null, array('regions' => \DateTimeZone::EUROPE))
|
||||
|
Reference in New Issue
Block a user