Skip to content

Commit 7d65fed

Browse files
committed
Update entity.rst
1 parent 6af779d commit 7d65fed

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

reference/forms/types/entity.rst

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,23 @@ This is the property that should be used for displaying the entities
9696
as text in the HTML element. If left blank, the entity object will be
9797
cast into a string and so must have a ``__toString()`` method.
9898

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:
99+
.. note::
103100

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-
));
101+
The ``property`` option is the property path used to display the option. So you
102+
can use anything supported by the :doc:`PropertyAccessor component</components/property_access/introduction>`
103+
104+
Usage sample::
105+
106+
$builder->add('gender', 'entity', array(
107+
'class' => 'MyBundle:Gender',
108+
'property' => 'translations[en].name',
109+
'query_builder' => function(EntityRepository $er) {
110+
return $er->createQueryBuilder('g')
111+
->join('g.translations', 't', 'WITH', 't.locale = :locale')
112+
->orderBy('t.name', 'ASC')
113+
->setParameter('locale', 'en');
114+
},
115+
));
115116

116117
group_by
117118
~~~~~~~~

0 commit comments

Comments
 (0)