Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2336e88

Browse filesBrowse files
committed
Trying to remove some duplication and some extra details
1 parent 439283a commit 2336e88
Copy full SHA for 2336e88

File tree

1 file changed

+7
-30
lines changed
Filter options

1 file changed

+7
-30
lines changed

‎reference/forms/types/entity.rst

Copy file name to clipboardExpand all lines: reference/forms/types/entity.rst
+7-30Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -194,39 +194,16 @@ return a ``QueryBuilder``.
194194
Overridden Options
195195
------------------
196196

197-
choice_name
198-
~~~~~~~~~~~
197+
.. include:: /reference/forms/types/options/choice_name.rst.inc
199198

200-
.. versionadded:: 2.7
201-
The ``choice_name`` option was introduced in Symfony 2.7.
202-
203-
**type**: ``string``, ``callable`` or :class:`Symfony\\Component\\PropertyAccess\\PropertyPath` **default**: id
204-
205-
By default the name of each field is the id of the entity, if it can be read
206-
from the class metadata by an internal id reader. Otherwise the process will
207-
fall back to using increasing integers.
208-
209-
choice_value
210-
~~~~~~~~~~~~
199+
In the ``EntityType``, this defaults to the ``id`` of the entity, if it can
200+
be read. Otherwise, it falls back to using auto-incrementing integers.
211201

212-
.. versionadded:: 2.7
213-
The ``choice_value`` option was introduced in Symfony 2.7.
214-
215-
**type**: ``string``, ``callable`` or :class:`Symfony\\Component\\PropertyAccess\\PropertyPath` **default**: id
216-
217-
As for the ``choice_name`` option, ``choice_value`` uses the id by default.
218-
It allows an optimization in the :class:``Symfony\\Bridge\\Doctrine\\Form\\ChoiceList\\Loader\\DoctrineChoiceLoader`` which will
219-
only load the ids passed as values while the form submission.
220-
It prevents all non submitted entities to be loaded from the database, even
221-
when defining the ``query_builder`` option.
222-
If it may be useful to set this option using an entity's property as string
223-
value (e.g for some API), you will gain performances by letting this option set
224-
by default.
225-
226-
.. note::
202+
.. include:: /reference/forms/types/options/choice_value.rst.inc
227203

228-
If the id cannot be read, for BC, the component checks if the class implements
229-
``__toString()`` and will use an incremental integer otherwise.
204+
In the ``EntityType``, this is overridden to use the ``id`` by default. When the
205+
``id`` is used, Doctrine only queries for the objects for the ids that were actually
206+
submitted.
230207

231208
choices
232209
~~~~~~~

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.