Skip to content

Commit

Permalink
feature #3124 Add note about the property attribute (Property Accesso…
Browse files Browse the repository at this point in the history
…r) (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)
  • Loading branch information
weaverryan committed Mar 18, 2014
2 parents bafd7ad + d1ca515 commit db3cde7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions reference/forms/types/entity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,20 @@ This is the property that should be used for displaying the entities
as text in the HTML element. If left blank, the entity object will be
cast into a string and so must have a ``__toString()`` method.

.. note::

The ``property`` option is the property path used to display the option. So you
can use anything supported by the
:doc:`PropertyAccessor component </components/property_access/introduction>`

For example, if the translations property is actually an associative array of
objects, each with a name property, then you could do this::

$builder->add('gender', 'entity', array(
'class' => 'MyBundle:Gender',
'property' => 'translations[en].name',
));

group_by
~~~~~~~~

Expand Down

0 comments on commit db3cde7

Please sign in to comment.