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 parent7496e68 commit46f1b8bCopy full SHA for 46f1b8b
reference/forms/types/entity.rst
@@ -102,17 +102,12 @@ cast into a string and so must have a ``__toString()`` method.
102
can use anything supported by the
103
:doc:`PropertyAccessor component</components/property_access/introduction>`
104
105
- Usage sample::
+ For example, if the translations property is actually an associative array of
106
+ objects, each with a name property, then you could do this::
107
108
$builder->add('gender', 'entity', array(
109
'class' => 'MyBundle:Gender',
110
'property' => 'translations[en].name',
- 'query_builder' => function(EntityRepository $er) {
111
- return $er->createQueryBuilder('g')
112
- ->join('g.translations', 't', 'WITH', 't.locale = :locale')
113
- ->orderBy('t.name', 'ASC')
114
- ->setParameter('locale', 'en');
115
- },
116
));
117
118
group_by