Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b634bbc

Browse filesBrowse files
committed
wrap lines
1 parent 61f8403 commit b634bbc
Copy full SHA for b634bbc

File tree

Expand file treeCollapse file tree

1 file changed

+20
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+20
-10
lines changed

‎reference/forms/types/options/error_mapping.rst.inc

Copy file name to clipboardExpand all lines: reference/forms/types/options/error_mapping.rst.inc
+20-10Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,29 @@ error_mapping
55

66
This 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.
910
Unfortunately, there is no "matchingCityAndZipCode" field in your form,
1011
so 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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.