8000 Fix docs related with choice form type refactor · symfony/symfony-docs@fd35e21 · GitHub
[go: up one dir, main page]

Skip to content

Commit fd35e21

Browse files
aivusweaverryan
authored andcommitted
Fix docs related with choice form type refactor
Changes related with http://symfony.com/blog/new-in-symfony-2-7-choice-form-type-refactorization
1 parent 6b9ade3 commit fd35e21

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

reference/forms/types/entity.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,12 @@ choice_label
110110
The ``choice_label`` option was introduced in Symfony 2.7. Prior to Symfony
111111
2.7, it was called ``property`` (which has the same functionality).
112112

113-
**type**: ``string``
113+
**type**: ``string`` or a Closure
114114

115115
This is the property that should be used for displaying the entities
116116
as text in the HTML element. If left blank, the entity object will be
117-
cast into a string and so must have a ``__toString()`` method.
117+
cast into a string and so must have a ``__toString()`` method. If using Closure, it should
118+
take a single argument, which is the entity and return the label of this entity.
118119

119120
.. note::
120121

@@ -152,7 +153,7 @@ instead of the default entity manager.
152153
group_by
153154
~~~~~~~~
154155

155-
**type**: ``string``
156+
**type**: ``string`` or a Closure
156157

157158
This is a property path (e.g. ``author.name``) used to organize the
158159
available choices in groups. It only works when rendered as a select tag

0 commit comments

Comments
 (0)
0