Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit267105f

Browse files
committed
Create error_mapping.rst.inc
| Q | A| ------------- | ---| Doc fix? | yes| New docs? | yes| Applies to | 2.1+| Fixed tickets | ~seehttp://symfony.com/blog/form-goodness-in-symfony-2-1#error-mapping-fu
1 parent3081634 commit267105f

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error_mapping
2+
~~~~~~~~~~~~~
3+
4+
**type**: ``array`` **default**: ``empty``
5+
6+
This option permitsto modify the default targetof errors.
7+
8+
Imagine a custom method named ``matchingCityAndZipCode`` validates whether the cityand zip code matches.
9+
Unfortunately, thereis no"matchingCityAndZipCode" fieldin your form,
10+
soall that Symfony candofor youis display the error on topof the form.
11+
12+
With customized error mapping, you cando better: make the error be mappedto the city field.
13+
14+
Here areto understand the leftand the right sideof the mapping:
15+
16+
* The left side containsproperty paths.
17+
*If the violationis generated on apropertyor methodof aclass, its pathis simply propertyName.
18+
*If the violationis generated on an entryof anarrayor 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.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp