Skip to content

Commit d346ae6

Browse files
committed
Improved choice list sections of UPGRADE and CHANGELOG
1 parent a676598 commit d346ae6

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

CHANGELOG-2.1.md

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -166,43 +166,30 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c
166166
* allowed setting different options for RepeatedType fields (like the label)
167167
* added support for empty form name at root level, this enables rendering forms
168168
without form name prefix in field names
169-
170-
* [BC BREAK] made form naming more restrictive. Form and field names must
171-
start with a letter, digit or underscore and only contain letters, digits,
172-
underscores, hyphens and colons
173-
169+
* [BC BREAK] form and field names must start with a letter, digit or underscore
170+
and only contain letters, digits, underscores, hyphens and colons
174171
* [BC BREAK] changed default name of the prototype in the "collection" type
175172
from "$$name$$" to "__name__". No dollars are appended/prepended to custom
176173
names anymore.
177-
178-
* [BC BREAK] greatly improved `ChoiceListInterface` and all of its
179-
implementations. `EntityChoiceList` was adapted, the methods `getEntities()`,
180-
`getEntitiesByKeys()`, `getIdentifier()` and `getIdentifierValues()` were
181-
removed/made private. Instead of the first two you can use `getChoices()`
182-
and `getChoicesByValues()`, for the latter two no replacement exists.
183-
`ArrayChoiceList` was replaced by `SimpleChoiceList`.
184-
`PaddedChoiceList`, `MonthChoiceList` and `TimezoneChoiceList` were removed.
185-
Their functionality was merged into `DateType`, `TimeType` and `TimezoneType`.
186-
187-
* [BC BREAK] removed `EntitiesToArrayTransformer` and `EntityToIdTransformer`.
188-
The former has been replaced by `CollectionToArrayTransformer` in combination
189-
with `EntityChoiceList`, the latter is not required in the core anymore.
174+
* [BC BREAK] improved ChoiceListInterface and all of its implementations
175+
* [BC BREAK] removed EntitiesToArrayTransformer and EntityToIdTransformer.
176+
The former has been replaced by CollectionToArrayTransformer in combination
177+
with EntityChoiceList, the latter is not required in the core anymore.
190178

191179
* [BC BREAK] renamed
192180

193-
* `ArrayToBooleanChoicesTransformer` to `ChoicesToBooleanArrayTransformer`
194-
* `ScalarToBooleanChoicesTransformer` to `ChoiceToBooleanArrayTransformer`
195-
* `ArrayToChoicesTransformer` to `ChoicesToValuesTransformer`
196-
* `ScalarToChoiceTransformer` to `ChoiceToValueTransformer`
197-
198-
to be consistent with the naming in `ChoiceListInterface`.
181+
* ArrayToBooleanChoicesTransformer to ChoicesToBooleanArrayTransformer
182+
* ScalarToBooleanChoicesTransformer to ChoiceToBooleanArrayTransformer
183+
* ArrayToChoicesTransformer to ChoicesToValuesTransformer
184+
* ScalarToChoiceTransformer to ChoiceToValueTransformer
199185

200-
* [BC BREAK] removed `FormUtil::toArrayKey()` and `FormUtil::toArrayKeys()`.
201-
They were merged into `ChoiceList` and have no public equivalent anymore.
186+
to be consistent with the naming in ChoiceListInterface.
202187

203-
* added `ComplexChoiceList` and `ObjectChoiceList`. Both let you select amongst
188+
* [BC BREAK] removed FormUtil::toArrayKey() and FormUtil::toArrayKeys().
189+
They were merged into ChoiceList and have no public equivalent anymore.
190+
* added ComplexChoiceList and ObjectChoiceList. Both let you select amongst
204191
objects in a choice field, but feature different constructors.
205-
* choice fields now throw a `FormException` if neither the "choices" nor the
192+
* choice fields now throw a FormException if neither the "choices" nor the
206193
"choice_list" option is set
207194
* the radio field is now a child type of the checkbox field
208195

UPGRADE-2.1.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,23 @@ UPGRADE FROM 2.0 to 2.1
7878
enable BC behaviour by setting the option "cascade_validation" to `true` on
7979
the parent form.
8080

81+
* Changed implementation of choice lists
82+
83+
ArrayChoiceList was replaced. If you have custom classes that extend
84+
ArrayChoiceList and load the choices in the constructor, you can extend
85+
SimpleChoiceList instead. If choices are loaded lazily, you should extend
86+
LazyChoiceList and implement its `loadChoiceList` method.
87+
88+
PaddedChoiceList, MonthChoiceList and TimezoneChoiceList were removed.
89+
Their functionality was merged into DateType, TimeType and
90+
TimezoneType.
91+
92+
EntityChoiceList was adapted. The methods `getEntities`,
93+
`getEntitiesByKeys`, `getIdentifier` and `getIdentifierValues` were
94+
removed/made private. Instead of the first two, you can now use
95+
`getChoices` and `getChoicesByValues`. For the latter two, no
96+
replacement exists.
97+
8198
* The strategy for generating the HTML attributes "id" and "name"
8299
of choices in a choice field has changed
83100

@@ -102,8 +119,8 @@ UPGRADE FROM 2.0 to 2.1
102119
* In the template of the choice type, the structure of the "choices" variable
103120
has changed
104121

105-
"choices" now contains ChoiceView objects with two getters `getValue()`
106-
and `getLabel()` to access the choice data. The indices of the array
122+
"choices" now contains ChoiceView objects with two getters `getValue`
123+
and `getLabel` to access the choice data. The indices of the array
107124
store an index whose generation is controlled by the "index_generation"
108125
option of the choice field.
109126

0 commit comments

Comments
 (0)