|
480 | 480 | ));
|
481 | 481 | ```
|
482 | 482 |
|
| 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 | +
|
483 | 520 | ### Validator
|
484 | 521 |
|
485 | 522 | * The methods `setMessage()`, `getMessageTemplate()` and
|
|
0 commit comments