File tree 2 files changed +71
-0
lines changed
Filter options
2 files changed +71
-0
lines changed
Original file line number Diff line number Diff line change @@ -186,6 +186,41 @@ Form
186
186
}
187
187
```
188
188
189
+ * In Symfony 2.7 a small BC break was introduced with the new choices_as_values
190
+ option. In order to have the choice values populated to the html value attribute
191
+ you had to define the choice_value option. This is now not any more needed.
192
+
193
+ Before:
194
+
195
+ ``` php
196
+ $form->add('status', 'choice', array(
197
+ 'choices' => array(
198
+ 'Enabled' => Status::ENABLED,
199
+ 'Disabled' => Status::DISABLED,
200
+ 'Ignored' => Status::IGNORED,
201
+ ),
202
+ 'choices_as_values' => true,
203
+ // important if you rely on your option value attribute (e.g. for JavaScript)
204
+ // this will keep the same functionality as before
205
+ 'choice_value' => function ($choice) {
206
+ return $choice;
207
+ },
208
+ ));
209
+ ```
210
+
211
+ After (Symfony 2.8+):
212
+
213
+ ``` php
214
+ $form->add('status', ChoiceType::class, array(
215
+ 'choices' => array(
216
+ 'Enabled' => Status::ENABLED,
217
+ 'Disabled' => Status::DISABLED,
218
+ 'Ignored' => Status::IGNORED,
219
+ ),
220
+ 'choices_as_values' => true
221
+ ));
222
+ ```
223
+
189
224
* Returning type instances from ` FormTypeInterface::getParent() ` is deprecated
190
225
and will not be supported anymore in Symfony 3.0. Return the fully-qualified
191
226
class name of the parent type class instead.
Original file line number Diff line number Diff line change @@ -365,6 +365,42 @@ UPGRADE FROM 2.x to 3.0
365
365
}
366
366
}
367
367
```
368
+
369
+ * In Symfony 2.7 a small BC break was introduced with the new choices_as_values
370
+ option. In order to have the choice values populated to the html value attribute
371
+ you had to define the choice_value option. This is now not any more needed.
372
+
373
+ Before:
374
+
375
+ ``` php
376
+ $form->add('status', 'choice', array(
377
+ 'choices' => array(
378
+ 'Enabled' => Status::ENABLED,
379
+ 'Disabled' => Status::DISABLED,
380
+ 'Ignored' => Status::IGNORED,
381
+ ),
382
+ // choices_as_values defaults to true in Symfony 3.0
383
+ // and setting it to anything else is deprecated as of 3.0
384
+ 'choices_as_values' => true,
385
+ // important if you rely on your option value attribute (e.g. for JavaScript)
386
+ // this will keep the same functionality as before
387
+ 'choice_value' => function ($choice) {
388
+ return $choice;
389
+ },
390
+ ));
391
+ ```
392
+
393
+ After:
394
+
395
+ ``` php
396
+ $form->add('status', ChoiceType::class, array(
397
+ 'choices' => array(
398
+ 'Enabled' => Status::ENABLED,
399
+ 'Disabled' => Status::DISABLED,
400
+ 'Ignored' => Status::IGNORED,
401
+ )
402
+ ));
403
+ ```
368
404
369
405
* The ` request ` service was removed. You must inject the ` request_stack `
370
406
service instead.
You can’t perform that action at this time.
0 commit comments