-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
adding property errorPath #9582
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
Conversation
it's very important to get fields names with errors when we use aja submit, i return form->getErrors() i'll get errors message with fields name
related with this add |
Why are #9581 and this one separate PRs? They belong together in one. |
@Tobion yes |
@Tobion they are separate, because @Belgacem-TLILI used the online editing from the symfony repo, which created 2 separate branches (one for each edition done on the repo where he has no write access). @Belgacem-TLILI you should do all the work in a single branch |
And I don't think this is necessary. The FormError is associated to a single Form instance. Putting the violation property path does not make sense IMO. The mapping is already done between the validator property path and the right form. |
@stof i have no the some idea, this add give user possibility to use the some existing function (getErrors) to render fields name without installing any other bundle or any personal function |
@Belgacem-TLILI And if you are using error_bubbling in your form to move all errors on the root form, errors are no longer attached to a child form in the tree. thus, ginving the property path of the violation in your object graph may not help the client code. The object graph does not need to match the form tree (you have a and even if the FormError contains the property path, you will still need a personal function to build the data in the format expected by your AJAX response. The only difference if your PR is merged is the logic you will put in it |
this is very useful and interesting |
actually I like this one. It'll fix #9472 |
this add will use existing function, there is no new class, no new functions, no installing new bundles |
@@ -52,15 +57,17 @@ class FormError | |||
* @param array $messageParameters The parameters that should be | |||
* substituted in the message template. | |||
* @param integer|null $messagePluralization The value for error message pluralization | |||
* @param string $errorPath The error field name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to line up description of property
would be better if you write tests or a use case even as a description and with code |
hello |
please use the standard table format for PR found in the docu @bschussek please could you take a look at this? @Belgacem-TLILI definitely this will not be merged, if it gets merged, as it is. As @stof and others have said please work this out in a single branch and create a new PR or push -f this one. |
Replaced by #9993. |
…o and the violation/exception that caused them (bschussek) This PR was merged into the 2.5-dev branch. Discussion ---------- [Form] Errors now reference the field they were added to and the violation/exception that caused them | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #9472, #9582 | License | MIT | Doc PR | - Commits ------- c8a0ee6 [Form] Errors now reference the field they were added to and the violation/exception that caused them
…added to and the violation/exception that caused them (bschussek) This PR was merged into the 2.5-dev branch. Discussion ---------- [Form] Errors now reference the field they were added to and the violation/exception that caused them | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#9472, symfony#9582 | License | MIT | Doc PR | - Commits ------- c8a0ee6 [Form] Errors now reference the field they were added to and the violation/exception that caused them
it's very important to get fields names with errors
when we use aja submit, i return form->getErrors()
i'll get errors message with fields name