File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,32 @@ Form
170
170
$form = $builder->getForm();
171
171
```
172
172
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
+
173
199
PropertyAccess
174
200
--------------
175
201
You can’t perform that action at this time.
0 commit comments