From b9696ada1d2dd806d0919bc2835e8433883ee987 Mon Sep 17 00:00:00 2001 From: Ilya Antipenko Date: Mon, 5 Oct 2015 13:48:23 +0300 Subject: [PATCH] Fix docs related with choice form type refactor Changes related with http://symfony.com/blog/new-in-symfony-2-7-choice-form-type-refactorization --- reference/forms/types/entity.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index 5aabfdd5f23..e6c26a35c37 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -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 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:: @@ -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