Skip to content

Commit 9c0a86d

Browse files
Christian Sweaverryan
authored andcommitted
Extended usage example for entity form type.
Hint (and example usage) about property option if no __toString() method is provided by the entity object. Otherwise new users could be irritated.
1 parent 01a7602 commit 9c0a86d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

reference/forms/types/entity.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,14 @@ be listed inside the choice field::
3939

4040
$builder->add('users', 'entity', array(
4141
'class' => 'AcmeHelloBundle:User',
42+
'property' => 'username',
4243
));
4344

4445
In this case, all ``User`` objects will be loaded from the database and rendered
4546
as either a ``select`` tag, a set or radio buttons or a series of checkboxes
4647
(this depends on the ``multiple`` and ``expanded`` values).
48+
If the entity object does not have a ``__toString()`` method the ``property`` option
49+
is needed.
4750

4851
Using a Custom Query for the Entities
4952
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)