Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3abbe91

Browse files
raziel057weaverryan
authored andcommitted
Update entity.rst
1 parent8eac7f3 commit3abbe91

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
@@ -118,22 +118,23 @@ This is the property that should be used for displaying the entities
118118
as text in the HTML element. If left blank, the entity object will be
119119
cast into a string and so must have a ``__toString()`` method.
120120

121-
Note: ``property`` is the property path used to display the option. So you
122-
can use anything supported by the:doc:`PropertyAccessor component</components/property_access/introduction>`
123-
124-
Usage sample:
121+
..note::
125122

126-
$builder->add('gender', 'entity', array(
127-
'class' => 'MyBundle:Gender',
128-
'property' => 'translations[en].name',
129-
'query_builder' => function(EntityRepository $er) {
130-
return $er->createQueryBuilder('g')
131-
->join('g.translations', 't')
132-
->where('t.locale = :locale')
133-
->orderBy('t.name', 'ASC')
134-
->setParameter('locale', 'en');
135-
},
136-
));
123+
The ``property`` option is the property path used to display the option. So you
124+
can use anything supported by the:doc:`PropertyAccessor component</components/property_access/introduction>`
125+
126+
Usage sample::
127+
128+
$builder->add('gender', 'entity', array(
129+
'class' => 'MyBundle:Gender',
130+
'property' => 'translations[en].name',
131+
'query_builder' => function(EntityRepository $er) {
132+
return $er->createQueryBuilder('g')
133+
->join('g.translations', 't', 'WITH', 't.locale = :locale')
134+
->orderBy('t.name', 'ASC')
135+
->setParameter('locale', 'en');
136+
},
137+
));
137138

138139
group_by
139140
~~~~~~~~

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp