8000 [Form] Updated UPGRADE and CHANGELOG · symfony/symfony@081c643 · GitHub
[go: up one dir, main page]

Skip to content

Commit 081c643

Browse files
committed
[Form] Updated UPGRADE and CHANGELOG
1 parent bbffd1b commit 081c643

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

UPGRADE-2.1.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,43 @@
480480
));
481481
```
482482
483+
* The "data_class" option now *must* be set if a form maps to an object. If
484+
you leave it empty, the form will expect an array or a scalar value and
485+
fail with a corresponding exception.
486+
487+
Likewise, if a form maps to an array, the option *must* be left empty now.
488+
489+
* The mapping of property paths to arrays has changed.
490+
491+
Previously, a property path "street" mapped to both a field `$street` of
492+
a class (or its accessors `getStreet()` and `setStreet()`) and an index
493+
`['street']` of an array or an object implementing `\ArrayAccess`.
494+
495+
Now, the property path "street" only maps to a class field (or accessors),
496+
while the property path "[street]" only maps to indices.
497+
498+
If you defined property paths manually in the "property_path" option, you
499+
should revise them and adjust them if necessary.
500+
501+
Before:
502+
503+
```
504+
$builder->add('name', 'text', array(
505+
'property_path' => 'address.street',
506+
));
507+
```
508+
509+
After (if the address object is an array):
510+
511+
```
512+
$builder->add('name', 'text', array(
513+
'property_path' => 'address[street]',
514+
));
515+
```
516+
517+
If address is an object in this case, the code given in "Before"
518+
works without changes.
519+
483520
### Validator
484521
485522
* The methods `setMessage()`, `getMessageTemplate()` and

src/Symfony/Component/Form/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@ CHANGELOG
7171
* labels don't display field attributes anymore. Label attributes can be
7272
passed in the "label_attr" option/variable
7373
* added option "mapped" which should be used instead of setting "property_path" to false
74+
* "data_class" now *must* be set if a form maps to an object and should be left empty otherwise
75+
* improved error mapping on forms

0 commit comments

Comments
 (0)
0