diff --git a/CHANGELOG-2.1.md b/CHANGELOG-2.1.md index f51c9827ea..b74f2b228a 100644 --- a/CHANGELOG-2.1.md +++ b/CHANGELOG-2.1.md @@ -166,43 +166,30 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c * allowed setting different options for RepeatedType fields (like the label) * added support for empty form name at root level, this enables rendering forms without form name prefix in field names - - * [BC BREAK] made form naming more restrictive. Form and field names must - start with a letter, digit or underscore and only contain letters, digits, - underscores, hyphens and colons - + * [BC BREAK] form and field names must start with a letter, digit or underscore + and only contain letters, digits, underscores, hyphens and colons * [BC BREAK] changed default name of the prototype in the "collection" type from "$$name$$" to "__name__". No dollars are appended/prepended to custom names anymore. - - * [BC BREAK] greatly improved `ChoiceListInterface` and all of its - implementations. `EntityChoiceList` was adapted, the methods `getEntities()`, - `getEntitiesByKeys()`, `getIdentifier()` and `getIdentifierValues()` were - removed/made private. Instead of the first two you can use `getChoices()` - and `getChoicesByValues()`, for the latter two no replacement exists. - `ArrayChoiceList` was replaced by `SimpleChoiceList`. - `PaddedChoiceList`, `MonthChoiceList` and `TimezoneChoiceList` were removed. - Their functionality was merged into `DateType`, `TimeType` and `TimezoneType`. - - * [BC BREAK] removed `EntitiesToArrayTransformer` and `EntityToIdTransformer`. - The former has been replaced by `CollectionToArrayTransformer` in combination - with `EntityChoiceList`, the latter is not required in the core anymore. + * [BC BREAK] improved ChoiceListInterface and all of its implementations + * [BC BREAK] removed EntitiesToArrayTransformer and EntityToIdTransformer. + The former has been replaced by CollectionToArrayTransformer in combination + with EntityChoiceList, the latter is not required in the core anymore. * [BC BREAK] renamed - * `ArrayToBooleanChoicesTransformer` to `ChoicesToBooleanArrayTransformer` - * `ScalarToBooleanChoicesTransformer` to `ChoiceToBooleanArrayTransformer` - * `ArrayToChoicesTransformer` to `ChoicesToValuesTransformer` - * `ScalarToChoiceTransformer` to `ChoiceToValueTransformer` + * ArrayToBooleanChoicesTransformer to ChoicesToBooleanArrayTransformer + * ScalarToBooleanChoicesTransformer to ChoiceToBooleanArrayTransformer + * ArrayToChoicesTransformer to ChoicesToValuesTransformer + * ScalarToChoiceTransformer to ChoiceToValueTransformer - to be consistent with the naming in `ChoiceListInterface`. + to be consistent with the naming in ChoiceListInterface. - * [BC BREAK] removed `FormUtil::toArrayKey()` and `FormUtil::toArrayKeys()`. - They were merged into `ChoiceList` and have no public equivalent anymore. - - * added `ComplexChoiceList` and `ObjectChoiceList`. Both let you select amongst + * [BC BREAK] removed FormUtil::toArrayKey() and FormUtil::toArrayKeys(). + They were merged into ChoiceList and have no public equivalent anymore. + * added ComplexChoiceList and ObjectChoiceList. Both let you select amongst objects in a choice field, but feature different constructors. - * choice fields now throw a `FormException` if neither the "choices" nor the + * choice fields now throw a FormException if neither the "choices" nor the "choice_list" option is set * the radio field is now a child type of the checkbox field diff --git a/UPGRADE-2.1.md b/UPGRADE-2.1.md index 9b79eb32ae..dbd2b3f6b5 100644 --- a/UPGRADE-2.1.md +++ b/UPGRADE-2.1.md @@ -78,6 +78,23 @@ UPGRADE FROM 2.0 to 2.1 enable BC behaviour by setting the option "cascade_validation" to `true` on the parent form. +* Changed implementation of choice lists + + ArrayChoiceList was replaced. If you have custom classes that extend + ArrayChoiceList and load the choices in the constructor, you can extend + SimpleChoiceList instead. If choices are loaded lazily, you should extend + LazyChoiceList and implement its `loadChoiceList` method. + + PaddedChoiceList, MonthChoiceList and TimezoneChoiceList were removed. + Their functionality was merged into DateType, TimeType and + TimezoneType. + + EntityChoiceList was adapted. The methods `getEntities`, + `getEntitiesByKeys`, `getIdentifier` and `getIdentifierValues` were + removed/made private. Instead of the first two, you can now use + `getChoices` and `getChoicesByValues`. For the latter two, no + replacement exists. + * The strategy for generating the HTML attributes "id" and "name" of choices in a choice field has changed @@ -102,8 +119,8 @@ UPGRADE FROM 2.0 to 2.1 * In the template of the choice type, the structure of the "choices" variable has changed - "choices" now contains ChoiceView objects with two getters `getValue()` - and `getLabel()` to access the choice data. The indices of the array + "choices" now contains ChoiceView objects with two getters `getValue` + and `getLabel` to access the choice data. The indices of the array store an index whose generation is controlled by the "index_generation" option of the choice field.