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] add "model_type" option to MoneyType#51884
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
yceruto 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.
Thanks Massimiliano for this improvement! I left a minor request.
src/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.phpShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
garak commentedOct 29, 2023
@xabbuh could you review, please? |
nicolas-grekas 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.
Please add a line in the chagelog of the component in section 7.1
Uh oh!
There was an error while loading.Please reload this page.
| $resolver->setNormalizer('model_type',staticfunction (Options$options,$value) { | ||
| if ('integer' ===$value &&1 ===$options['divisor']) { | ||
| thrownewLogicException('Can use integer "model_type" option only when the "divisor" option is not 1.'); |
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.
| thrownewLogicException('Can use integer"model_type" optiononly whenthe "divisor" optionis not1.'); | |
| thrownewLogicException('When the"model_type" optionis set to "integer",the "divisor" optionshould notbe set to "1".'); |
but why?
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.
Because if you set the divisor to 1, you can end up with a float instead of an integer, and lose decimals in the casting
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.
I'm sorry I don't get it. Also the original PR had exactly the opposite : throwing when the divisor isnot 1.
https://github.com/symfony/symfony/pull/50720/files#diff-eb30dc48f2b749fa5d76ce9598bb51c00fcb97bd7a10337f0630db00f5ba3b9aR100
I'm pretty sure I'm missing something 😬
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.
I know, and indeed I added a note about that when I opened this PR.
Uh oh!
There was an error while loading.Please reload this page.
garak commentedNov 25, 2023
I see no changelog for 7.1, should I create a new file? |
nicolas-grekas commentedNov 25, 2023
Uh oh!
There was an error while loading.Please reload this page.
e5dfc53 to8811741Comparefabpot commentedDec 29, 2023
Thank you@garak. |
Uh oh!
There was an error while loading.Please reload this page.
This is a replacement for abandoned#50720
Please notice that the previous PR misunderstood the related issue: the intended casting should be applied when the divisor is not 1, otherwise it doesn't make sense.