File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,17 @@ as either a ``select`` tag, a set or radio buttons or a series of checkboxes
55
55
If the entity object does not have a ``__toString() `` method the ``property `` option
56
56
is needed.
57
57
58
+ Using Choices
59
+ ~~~~~~~~~~~~~
60
+
61
+ If you want to limit the entities which are available as choices you can provide
62
+ them by calling the getter function of an entity:
63
+
64
+ $builder->add('users', 'entity', array(
65
+ 'class' => 'AcmeHelloBundle:User',
66
+ 'choices' => $group->getUsers(),
67
+ ));
68
+
58
69
Using a Custom Query for the Entities
59
70
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60
71
@@ -132,15 +143,17 @@ Overridden Options
132
143
choices
133
144
~~~~~~~
134
145
135
- **default **: ``null ``
146
+ **type **: array || ``\Traversable `` **default **: all entities
147
+
148
+ If the choices are provided only these will be available. The choices need to
149
+ be a traversable collection such as the
150
+ ``Doctrine\Common\Collections\ArrayCollection `` containing only entities of the
151
+ specified class.
136
152
137
153
choice_list
138
154
~~~~~~~~~~~
139
155
140
- **default **: all entities selected
141
-
142
- The choices will default to all entities selected with one of the options that
143
- are documented above.
156
+ **default **: ``null ``
144
157
145
158
Inherited options
146
159
-----------------
You can’t perform that action at this time.
0 commit comments