Skip to content

Fix docs after choice form type refactor #5755

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

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
7 changes: 4 additions & 3 deletions reference/forms/types/entity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,12 @@ choice_label
The ``choice_label`` option was introduced in Symfony 2.7. Prior to Symfony
2.7, it was called ``property`` (which has the same functionality).

**type**: ``string``
**type**: ``string`` or a Closure
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather write string|Closure instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exactly (see my comment below)


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

.. note::

Expand Down Expand Up @@ -152,7 +153,7 @@ instead of the default entity manager.
group_by
~~~~~~~~

**type**: ``string``
**type**: ``string`` or a Closure

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