Skip to content

Commit db3cde7

Browse files
committed
feature #3124 Add note about the property attribute (Property Accessor) (raziel057)
This PR was submitted for the 2.2 branch but it was merged into the 2.3 branch instead (closes #3124). Discussion ---------- Add note about the property attribute (Property Accessor) I think we must document the fact that propety is a path which is evaluted by the PropertyAccessor component. Commits ------- 46f1b8b Update entity.rst 7496e68 Update entity.rst c097f9b Update entity.rst 7d65fed Update entity.rst 6af779d Add note about the property attribute (Property Accessor)
2 parents bafd7ad + d1ca515 commit db3cde7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

reference/forms/types/entity.rst

+14
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ 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::
122+
123+
The ``property`` option is the property path used to display the option. So you
124+
can use anything supported by the
125+
:doc:`PropertyAccessor component </components/property_access/introduction>`
126+
127+
For example, if the translations property is actually an associative array of
128+
objects, each with a name property, then you could do this::
129+
130+
$builder->add('gender', 'entity', array(
131+
'class' => 'MyBundle:Gender',
132+
'property' => 'translations[en].name',
133+
));
134+
121135
group_by
122136
~~~~~~~~
123137

0 commit comments

Comments
 (0)