Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] invalidate forms on transformation failures#28731
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
b7df8b9 to6cf76d1Comparexabbuh commentedOct 31, 2018
Test added, PR is ready from my POV |
| $message = 'This value is not valid.'; | ||
| if (null !== $this->translator) { | ||
| $message = $this->translator->trans($message, array('{{ value }}' => $clientDataAsString)); |
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.
The message is static then shouldn't the placeholder be there?->trans('This value {{ value }} is not valid.', array('{{ value }}' => $clientDataAsString)) ?
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.
fixed, thanks for catching it
| $message = $this->translator->trans($message, array('{{ value }}' => $clientDataAsString)); | ||
| } | ||
| $form->addError(new FormError($message, 'This value is not valid.', array('{{ value }}' => $clientDataAsString), null, $form->getTransformationFailure())); |
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.
Same here for the message template (2nd argument)
src/Symfony/Component/Form/Extension/Core/Type/TransformationFailureExtension.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
xabbuh commentedNov 10, 2018
ping @symfony/deciders :) |
| foreach ($form as $child) { | ||
| if (!$child->isSynchronized()) { | ||
| $childrenSynchronized = false; | ||
| break; |
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.
Would be more elegant to justreturn here. Then you wouldn't need $childrenSynchronized variable and guard it later at all
HeahDude left a comment
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.
So elegant :), 👍
fabpot commentedNov 12, 2018
Thank you@xabbuh. |
This PR was merged into the 2.8 branch.Discussion----------[Form] invalidate forms on transformation failures| Q | A| ------------- | ---| Branch? | 2.8| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#20916,#21242,#28584| License | MIT| Doc PR |Commits-------385d9df invalidate forms on transformation failures
Uh oh!
There was an error while loading.Please reload this page.