Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Form] fixed CollectionType options #6488

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions reference/forms/types/collection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ relationships (e.g. a product from where you can manage many related product
photos).

+-------------+-----------------------------------------------------------------------------+
| Rendered as | depends on the `entry_type`_ option |
| Rendered as | depends on the `type`_ option |
+-------------+-----------------------------------------------------------------------------+
| Options | - `allow_add`_ |
| | - `allow_delete`_ |
| | - `delete_empty`_ |
| | - `entry_options`_ |
| | - `entry_type`_ |
| | - `options`_ |
| | - `prototype`_ |
| | - `prototype_name`_ |
| | - `type`_ |
+-------------+-----------------------------------------------------------------------------+
| Inherited | - `by_reference`_ |
| options | - `empty_data`_ |
Expand Down Expand Up @@ -276,8 +276,8 @@ form you have to set this option to true. However, existing collection entries
will only be deleted if you have the allow_delete_ option enabled. Otherwise
the empty values will be kept.

entry_options
~~~~~~~~~~~~~
options
~~~~~~~

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

Expand All @@ -292,28 +292,17 @@ type::
// ...

$builder->add('favorite_cities', CollectionType::class, array(
'entry_type' => ChoiceType::class,
'entry_type' => 'choice,
'entry_options' => array(
'choices' => array(
'Nashville' => 'nashville',
'Paris' => 'paris',
'Berlin' => 'berlin',
'London' => 'london',
'nashville' => 'Nashville',
'paris' => 'Paris',
'berlin' => 'Berlin',
'london' => 'London',
),
),
));

entry_type
~~~~~~~~~~

**type**: ``string`` or :class:`Symfony\\Component\\Form\\FormTypeInterface` **required**

This is the field type for each item in this collection (e.g. ``TextType``,
``ChoiceType``, etc). For example, if you have an array of email addresses,
you'd use the :doc:`EmailType </reference/forms/types/email>`. If you want
to embed a collection of some other form, create a new instance of your
form type and pass it as this option.

prototype
~~~~~~~~~

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

type
~~~~

**type**: ``string`` or :class:`Symfony\\Component\\Form\\FormTypeInterface` **required**

This is the field type for each item in this collection (e.g. ``TextType``,
``ChoiceType``, etc). For example, if you have an array of email addresses,
you'd use the :doc:`EmailType </reference/forms/types/email>`. If you want
to embed a collection of some other form, create a new instance of your
form type and pass it as this option.

Inherited Options
-----------------

Expand Down