8000 Update UPGRADE-2.3.md to account for #9388 · symfony/symfony@8a73974 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a73974

Browse files
ureimersfabpot
authored andcommitted
Update UPGRADE-2.3.md to account for #9388
1 parent 6e0848d commit 8a73974

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

UPGRADE-2.3.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,32 @@ Form
170170
$form = $builder->getForm();
171171
```
172172

173+
* Previously, when the "data" option of a field was set to `null` and the
174+
containing form was mapped to an object, the field would receive the data
175+
from the object as default value. This functionality was unintended and fixed
176+
to use `null` as default value in Symfony 2.3.
177+
178+
In cases where you made use of the previous behavior, you should now remove
179+
the "data" option altogether.
180+
181+
Before:
182+
183+
```
184+
$builder->add('field', 'text', array(
185+
'data' => $defaultData ?: null,
186+
));
187+
```
188+
189+
After:
190+
191+
```
192+
$options = array();
193+
if ($defaultData) {
194+
$options['data'] = $defaultData;
195+
}
196+
$builder->add('field', 'text', $options);
197+
```
198+
173199
PropertyAccess
174200
--------------
175201

0 commit comments

Comments
 (0)
0