@@ -5,19 +5,29 @@ error_mapping
5
5
6
6
This option permitsto modify the default targetof errors.
7
7
8
- Imagine a custom method named ``matchingCityAndZipCode`` validates whether the cityand zip code matches.
8
+ Imagine a custom method named ``matchingCityAndZipCode`` validates
9
+ whether the cityand zip code matches.
9
10
Unfortunately, thereis no" matchingCityAndZipCode" fieldin your form,
10
11
soall that Symfony cando for youis display the error on topof the form.
11
12
12
- With customized error mapping, you cando better: make the error be mappedto the city field.
13
+ With customized error mapping, you cando better:
14
+ make the error be mappedto the city field.
13
15
14
- Here areto understand the leftand the right sideof the mapping:
16
+ Here arethe rules to understand the leftand the right sideof the mapping:
15
17
16
18
* The left side containsproperty paths.
17
- *If the violationis generated on aproperty or methodof aclass , its pathis simply propertyName.
18
- *If the violationis generated on an entryof anarray or ArrayAccessobject , theproperty pathis [indexName].
19
- * You can construct nestedproperty paths by concatenating them, separating properties by dots,
20
- *for example: addresses[work].matchingCityAndZipCode
21
- *The right side contains simply the namesof fieldsin the form.
22
- * The left sideof the error mapping also accepts a dot ., which refersto the field itself.
23
- That means that any error addedto the fieldis addedto the given nested field instead.
19
+ *If the violationis generated on aproperty or methodof aclass ,
20
+ its pathis simply propertyName.
21
+ *If the violationis generated on an entryof an ``array ``
22
+ or ``ArrayAccess``object , theproperty pathis ``[indexName]``.
23
+ * You can construct nestedproperty paths by concatenating them,
24
+ separating properties by dots,
25
+ *for example: ``addresses[work].matchingCityAndZipCode``
26
+ * The left sideof the error mapping also accepts a dot ``.``,
27
+ which refersto the field itself.
28
+ That means that any error addedto the fieldis addedto the given
29
+ nested field instead.
30
+ * The right side contains simply the namesof fieldsin the form.
31
+
32
+ .. versionadded::2.1
33
+ The ``error_mapping`` optionis newto Symfony2.1 .