Skip to content

Commit

Permalink
feature #17732 [DEPRECATION] : deprecated support for Traversable in …
Browse files Browse the repository at this point in the history
…method ResizeFormListener::PreSubmit (ybensacq)

This PR was squashed before being merged into the 3.1-dev branch (closes #17732).

Discussion
----------

[DEPRECATION] : deprecated support for Traversable in method ResizeFormListener::PreSubmit

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #17701
| License       | MIT

Commits
-------

68c9305 [DEPRECATION] : deprecated support for Traversable in method ResizeFormListener::PreSubmit
  • Loading branch information
fabpot committed Feb 18, 2016
2 parents 0acca48 + 68c9305 commit ff87f30
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions UPGRADE-3.1.md
Expand Up @@ -15,6 +15,9 @@ Form

* The `choices_as_values` option of the `ChoiceType` has been deprecated and
will be removed in Symfony 4.0.
* Support for data objects that implements both `Traversable` and `ArrayAccess`
in `ResizeFormListener::preSubmit` method has been deprecated and will be
removed in Symfony 4.0.

HttpKernel
----------
Expand Down
2 changes: 2 additions & 0 deletions UPGRADE-4.0.md
Expand Up @@ -13,6 +13,8 @@ Form
----

* The `choices_as_values` option of the `ChoiceType` has been removed.
* Support for data objects that implements both `Traversable` and
`ArrayAccess` in `ResizeFormListener::preSubmit` method has been removed

HttpKernel
----------
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Form/CHANGELOG.md
Expand Up @@ -5,6 +5,8 @@ CHANGELOG
-----

* deprecated the "choices_as_values" option of ChoiceType
* deprecated support for data objects that implements both `Traversable` and
`ArrayAccess` in `ResizeFormListener::preSubmit` method

3.0.0
-----
Expand Down
Expand Up @@ -102,6 +102,10 @@ public function preSubmit(FormEvent $event)
$form = $event->getForm();
$data = $event->getData();

if ($data instanceof \Traversable && $data instanceof \ArrayAccess) {
@trigger_error('Support for objects implementing both \Traversable and \ArrayAccess is deprecated since version 3.1 and will be removed in 4.0. Use an array instead.', E_USER_DEPRECATED);
}

if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
$data = array();
}
Expand Down

0 comments on commit ff87f30

Please sign in to comment.