This is what the Symfony UPGRADE from 2.0 to 2.1 says:
The mapping of property paths to arrays has changed.
Previously, a property path "street"
mapped to both a field $street
of a class (or its accessors getStreet()
and setStreet()
) and an index ['street']
of an array or an object implementing \ArrayAccess
.
Now, the property path "street"
only maps to a class field (or accessors), while the property path "[street]"
only maps to indices.
Also take a look on Symfony's documentation about the PropertyAccess component.
The purpose of property_path
is explained in the FormType Field page but I guess you already know what it is used for.
For the code you posted I guess (I used Symfony forms only once, just scratched its surface) that for each property bar
of object $foo
it creates an <input type="checkbox" name="foo_bar">
.
When the form is submitted, the property_path
tells the form to put the value of the checkbox named foo_bar
into $data['bar']->foo
where $data
is the object returned by method getData()
of the form.