Skip to content

Commit 2217c1f

Browse files
committed
minor #15174 [Form] Added upgrade notes for #15061 (webmozart)
This PR was merged into the 2.7 branch. Discussion ---------- [Form] Added upgrade notes for #15061 | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This PR contains the upgrade notes for #15061. Commits ------- 6325b4c [Form] Added upgrade notes for #15061
2 parents 8c999b5 + 6325b4c commit 2217c1f

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

UPGRADE-2.7.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,3 +665,57 @@ Security
665665
* `SwitchUserListener`
666666
* `AccessListener`
667667
* `RememberMeListener`
668+
669+
UPGRADE FROM 2.7.1 to 2.7.2
670+
===========================
671+
672+
Form
673+
----
674+
675+
* In order to fix a few regressions in the new `ChoiceList` implementation,
676+
a few details had to be changed compared to 2.7.
677+
678+
The legacy `Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface`
679+
now does not extend the new `Symfony\Component\Form\ChoiceList\ChoiceListInterface`
680+
anymore. If you pass an implementation of the old interface in a context
681+
where the new interface is required, wrap the list into a
682+
`LegacyChoiceListAdapter`:
683+
684+
Before:
685+
686+
```php
687+
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
688+
689+
function doSomething(ChoiceListInterface $choiceList)
690+
{
691+
// ...
692+
}
693+
694+
doSomething($legacyList);
695+
```
696+
697+
After:
698+
699+
```php
700+
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
701+
use Symfony\Component\Form\ChoiceList\LegacyChoiceListAdapter;
702+
703+
function doSomething(ChoiceListInterface $choiceList)
704+
{
705+
// ...
706+
}
707+
708+
doSomething(new LegacyChoiceListAdapter($legacyList));
709+
```
710+
711+
The new `ChoiceListInterface` now has two additional methods
712+
`getStructuredValues()` and `getOriginalKeys()`. You should add these methods
713+
if you implement this interface. See their doc blocks and the implementation
714+
of the core choice lists for inspiration.
715+
716+
The method `ArrayKeyChoiceList::toArrayKey()` was marked as internal. This
717+
method was never supposed to be used outside the class.
718+
719+
The method `ChoiceListFactoryInterface::createView()` does not accept arrays
720+
and `Traversable` instances anymore for the `$groupBy` parameter. Pass a
721+
callable instead.

0 commit comments

Comments
 (0)