Skip to content

Commit 2c754b1

Browse files
committed
[Form] fixed CollectionType options
1 parent 1653948 commit 2c754b1

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

reference/forms/types/collection.rst

+21-21
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ relationships (e.g. a product from where you can manage many related product
1212
photos).
1313

1414
+-------------+-----------------------------------------------------------------------------+
15-
| Rendered as | depends on the `entry_type`_ option |
15+
| Rendered as | depends on the `type`_ option |
1616
+-------------+-----------------------------------------------------------------------------+
1717
| Options | - `allow_add`_ |
1818
| | - `allow_delete`_ |
1919
| | - `delete_empty`_ |
20-
| | - `entry_options`_ |
21-
| | - `entry_type`_ |
20+
| | - `options`_ |
2221
| | - `prototype`_ |
2322
| | - `prototype_name`_ |
23+
| | - `type`_ |
2424
+-------------+-----------------------------------------------------------------------------+
2525
| Inherited | - `by_reference`_ |
2626
| options | - `empty_data`_ |
@@ -276,8 +276,8 @@ form you have to set this option to true. However, existing collection entries
276276
will only be deleted if you have the allow_delete_ option enabled. Otherwise
277277
the empty values will be kept.
278278

279-
entry_options
280-
~~~~~~~~~~~~~
279+
options
280+
~~~~~~~
281281

282282
**type**: ``array`` **default**: ``array()``
283283

@@ -292,28 +292,17 @@ type::
292292
// ...
293293

294294
$builder->add('favorite_cities', CollectionType::class, array(
295-
'entry_type' => ChoiceType::class,
295+
'entry_type' => 'choice,
296296
'entry_options' => array(
297297
'choices' => array(
298-
'Nashville' => 'nashville',
299-
'Paris' => 'paris',
300-
'Berlin' => 'berlin',
301-
'London' => 'london',
298+
'nashville' => 'Nashville',
299+
'paris' => 'Paris',
300+
'berlin' => 'Berlin',
301+
'london' => 'London',
302302
),
303303
),
304304
));
305305

306-
entry_type
307-
~~~~~~~~~~
308-
309-
**type**: ``string`` or :class:`Symfony\\Component\\Form\\FormTypeInterface` **required**
310-
311-
This is the field type for each item in this collection (e.g. ``TextType``,
312-
``ChoiceType``, etc). For example, if you have an array of email addresses,
313-
you'd use the :doc:`EmailType </reference/forms/types/email>`. If you want
314-
to embed a collection of some other form, create a new instance of your
315-
form type and pass it as this option.
316-
317306
prototype
318307
~~~~~~~~~
319308

@@ -362,6 +351,17 @@ If you have several collections in your form, or worse, nested collections
362351
you may want to change the placeholder so that unrelated placeholders are
363352
not replaced with the same value.
364353

354+
type
355+
~~~~
356+
357+
**type**: ``string`` or :class:`Symfony\\Component\\Form\\FormTypeInterface` **required**
358+
359+
This is the field type for each item in this collection (e.g. ``TextType``,
360+
``ChoiceType``, etc). For example, if you have an array of email addresses,
361+
you'd use the :doc:`EmailType </reference/forms/types/email>`. If you want
362+
to embed a collection of some other form, create a new instance of your
363+
form type and pass it as this option.
364+
365365
Inherited Options
366366
-----------------
367367

0 commit comments

Comments
 (0)