@@ -5,19 +5,29 @@ error_mapping
55
66This option permits to modify the default target of errors.
77
8- Imagine a custom method named ``matchingCityAndZipCode`` validates whether the city and zip code matches.
8+ Imagine a custom method named ``matchingCityAndZipCode`` validates
9+ whether the city and zip code matches.
910Unfortunately, there is no " matchingCityAndZipCode" field in your form,
1011so all that Symfony can do for you is display the error on top of the form.
1112
12- With customized error mapping, you can do better: make the error be mapped to the city field.
13+ With customized error mapping, you can do better:
14+ make the error be mapped to the city field.
1315
14- Here are to understand the left and the right side of the mapping:
16+ Here are the rules to understand the left and the right side of the mapping:
1517
1618 * The left side contains property paths.
17- * If the violation is generated on a property or method of a class , its path is simply propertyName.
18- * If the violation is generated on an entry of an array or ArrayAccess object , the property path is [indexName].
19- * You can construct nested property paths by concatenating them, separating properties by dots,
20- * for example: addresses[work].matchingCityAndZipCode
21- *The right side contains simply the names of fields in the form.
22- * The left side of the error mapping also accepts a dot ., which refers to the field itself.
23- That means that any error added to the field is added to the given nested field instead.
19+ * If the violation is generated on a property or method of a class ,
20+ its path is simply propertyName.
21+ * If the violation is generated on an entry of an ``array ``
22+ or ``ArrayAccess`` object , the property path is ``[indexName]``.
23+ * You can construct nested property paths by concatenating them,
24+ separating properties by dots,
25+ * for example: ``addresses[work].matchingCityAndZipCode``
26+ * The left side of the error mapping also accepts a dot ``.``,
27+ which refers to the field itself.
28+ That means that any error added to the field is added to the given
29+ nested field instead.
30+ * The right side contains simply the names of fields in the form.
31+
32+ .. versionadded:: 2.1
33+ The ``error_mapping`` option is new to Symfony 2.1 .
0 commit comments