Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[reference] [form] [options] fix #6153 #6156

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions reference/forms/types/options/error_mapping.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ Here are the rules for the left and the right side of the mapping:
object, the property path is ``[indexName]``;
* You can construct nested property paths by concatenating them, separating
properties by dots. For example: ``addresses[work].matchingCityAndZipCode``;
* The left side of the error mapping also accepts a dot ``.``, which refers
to the field itself. That means that any error added to the field is added
to the given nested field instead;
* The right side contains simply the names of fields in the form.

Additionally, you can set the left side to dot ``.`` which refers to any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change "[...] to dot . which refers [...]" to "[...] to dot (.), which refers [...]"

unmapped property or methods needing validation to the given nested field instead
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use either "any unmapped property or method" or "any unmapped properties or methods". Unfortunately, I'm not sure which of these 2 are correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both are corrects, but since it can map many properties and methods we should use the second option.

of bubbling them to the form::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I still find this sentence confusing and suggest to change it to something like this:

By default, errors for any property that is not mapped will bubble up to the parent form. You can use the dot (.) on the left side to map errors of all unmapped properties to a particular field.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wouterj, thanks for merging this. I agree with @xabbuh for the rephrasing except for "parent form" and "a particular field" because it's not obvious that (.) symbolise the current FormType being configured with defaultOptions()|configureOptions(). It should be respectively "current FormType" and "one of its children" instead IMHO.


$resolver->setDefaults(array(
'error_mapping' => array(
'.' => 'city',
),
));