@@ -16,10 +16,10 @@ forms, which is useful when creating forms that expose one-to-many relationships
16
16
| Options | - `allow_add `_ |
17
17
| | - `allow_delete `_ |
18
18
| | - `delete_empty `_ |
19
- | | - `options `_ |
19
+ | | - `entry_options `_ |
20
+ | | - `entry_type `_ |
20
21
| | - `prototype `_ |
21
22
| | - `prototype_name `_ |
22
- | | - `type `_ |
23
23
+-------------+-----------------------------------------------------------------------------+
24
24
| Inherited | - `by_reference `_ |
25
25
| options | - `cascade_validation `_ |
@@ -52,10 +52,10 @@ to an array of email addresses. In the form, you want to expose each email
52
52
address as its own input text box::
53
53
54
54
$builder->add('emails', 'collection', array(
55
- // each item in the array will be an "email" field
56
- 'type ' => 'email',
55
+ // each entry in the array will be an "email" field
56
+ 'entry_type ' => 'email',
57
57
// these options are passed to each "email" type
58
- 'options ' => array(
58
+ 'entry_options ' => array(
59
59
'required' => false,
60
60
'attr' => array('class' => 'email-box')
61
61
),
@@ -266,19 +266,24 @@ form you have to set this option to true. However, existing collection entries
266
266
will only be deleted if you have the allow_delete _ option enabled. Otherwise
267
267
the empty values will be kept.
268
268
269
- options
270
- ~~~~~~~
269
+ entry_options
270
+ ~~~~~~~~~~~~~
271
+
272
+ .. versionadded :: 2.7
273
+ The ``entry_options `` option was introduced in Symfony 2.7 in favor of
274
+ ``options ``, which is available prior to 2.7.
271
275
272
276
**type **: ``array `` **default **: ``array() ``
273
277
274
- This is the array that's passed to the form type specified in the `type `_
278
+ This is the array that's passed to the form type specified in the `entry_type `_
275
279
option. For example, if you used the :doc: `choice </reference/forms/types/choice >`
276
- type as your `type `_ option (e.g. for a collection of drop-down menus), then
277
- you'd need to at least pass the ``choices `` option to the underlying type::
280
+ type as your `entry_type `_ option (e.g. for a collection of drop-down menus),
281
+ then you'd need to at least pass the ``choices `` option to the underlying
282
+ type::
278
283
279
284
$builder->add('favorite_cities', 'collection', array(
280
- 'type ' => 'choice',
281
- 'options ' => array(
285
+ 'entry_type ' => 'choice',
286
+ 'entry_options ' => array(
282
287
'choices' => array(
283
288
'nashville' => 'Nashville',
284
289
'paris' => 'Paris',
@@ -288,6 +293,21 @@ you'd need to at least pass the ``choices`` option to the underlying type::
288
293
),
289
294
));
290
295
296
+ entry_type
297
+ ~~~~~~~~~~
298
+
299
+ .. versionadded :: 2.7
300
+ The ``entry_type `` option was introduced in Symfony 2.7 in favor of
301
+ ``type ``, which is available prior to 2.7.
302
+
303
+ **type **: ``string `` or :class: `Symfony\\ Component\\ Form\\ FormTypeInterface ` **required **
304
+
305
+ This is the field type for each entry in this collection (e.g. ``text ``, ``choice ``,
306
+ etc). For example, if you have an array of email addresses, you'd use the
307
+ :doc: `email </reference/forms/types/email >` type. If you want to embed
308
+ a collection of some other form, create a new instance of your form type
309
+ and pass it as this option.
310
+
291
311
prototype
292
312
~~~~~~~~~
293
313
@@ -336,17 +356,6 @@ If you have several collections in your form, or worse, nested collections
336
356
you may want to change the placeholder so that unrelated placeholders are not
337
357
replaced with the same value.
338
358
339
- type
340
- ~~~~
341
-
342
- **type **: ``string `` or :class: `Symfony\\ Component\\ Form\\ FormTypeInterface ` **required **
343
-
344
- This is the field type for each item in this collection (e.g. ``text ``, ``choice ``,
345
- etc). For example, if you have an array of email addresses, you'd use the
346
- :doc: `email </reference/forms/types/email >` type. If you want to embed
347
- a collection of some other form, create a new instance of your form type
348
- and pass it as this option.
349
-
350
359
Inherited Options
351
360
-----------------
352
361
0 commit comments