Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #20978 [Form] TransformationFailedException: Support specifyi…
…ng message to display (ogizanagi) This PR was merged into the 4.3-dev branch. Discussion ---------- [Form] TransformationFailedException: Support specifying message to display | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #22501 | License | MIT | Doc PR | N/A Currently, a failed transformation can't display a very accurate message, as it only uses the value of the `invalid_message` option. I suggest to add more flexibility, somehow the same way we did for `CustomUserMessageAuthenticationException`. A test case in `FormTypeTest` shows a use-case based on @webmozart's [blog post about value/immutable objects in Symfony forms](https://webmozart.io/blog/2015/09/09/value-objects-in-symfony-forms/). ~I named the exception properties and methods the same way as for `CustomUserMessageAuthenticationException`, but do you think the followings would be better:~ - ~`setSafeMessage` ➜ `setInvalidMessage`~ - ~`getMessageKey` ➜ `getInvalidMessageKey`~ - ~`getMessageData` ➜ `getInvalidMessageParameters`~ ~in order to echoes `invalid_message` and `invalid_message_parameters` options?~ => Replaced to use `invalidMessage` & `invalidMessageParameters` Commits ------- d11055c [Form] TransformationFailedException: Support specifying message to display
- Loading branch information
Showing
5 changed files
with
169 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters