We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent4725f4f commit6af779dCopy full SHA for 6af779d
reference/forms/types/entity.rst
@@ -96,6 +96,23 @@ This is the property that should be used for displaying the entities
96
as text in the HTML element. If left blank, the entity object will be
97
cast into a string and so must have a ``__toString()`` method.
98
99
+Note: ``property`` is the property path used to display the option. So you
100
+can use anything supported by the:doc:`PropertyAccessor component</components/property_access/introduction>`
101
+
102
+Usage sample:
103
104
+ $builder->add('gender', 'entity', array(
105
+ 'class' => 'MyBundle:Gender',
106
+ 'property' => 'translations[en].name',
107
+ 'query_builder' => function(EntityRepository $er) {
108
+ return $er->createQueryBuilder('g')
109
+ ->join('g.translations', 't')
110
+ ->where('t.locale = :locale')
111
+ ->orderBy('t.name', 'ASC')
112
+ ->setParameter('locale', 'en');
113
+ },
114
+ ));
115
116
group_by
117
~~~~~~~~
118