Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:7.1fromgarak:moneytype_new_option
Dec 29, 2023

Conversation

@garak
Copy link
Contributor

@garakgarak commentedOct 7, 2023
edited by fabpot
Loading

QA
Branch?7.1
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#50707
LicenseMIT

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.

dawkaa reacted with laugh emoji
@carsonbotcarsonbot added this to the6.4 milestoneOct 7, 2023
@carsonbotcarsonbot changed the titleadd "model_type" option to MoneyType[Form] add "model_type" option to MoneyTypeOct 7, 2023
Copy link
Member

@ycerutoyceruto left a 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.

@garak
Copy link
ContributorAuthor

@xabbuh could you review, please?

@nicolas-grekasnicolas-grekas modified the milestones:6.4,7.1Nov 15, 2023
Copy link
Member

@nicolas-grekasnicolas-grekas left a 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


$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.');

Choose a reason for hiding this comment

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

Suggested change
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?

Copy link
ContributorAuthor

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

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 😬

Copy link
ContributorAuthor

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.

@garak
Copy link
ContributorAuthor

Please add a line in the chagelog of the component in section 7.1

I see no changelog for 7.1, should I create a new file?

@nicolas-grekas
Copy link
Member

@fabpot
Copy link
Member

Thank you@garak.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@fabpotfabpotfabpot approved these changes

@ycerutoycerutoyceruto approved these changes

@xabbuhxabbuhAwaiting requested review from xabbuhxabbuh is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

7.1

Development

Successfully merging this pull request may close these issues.

Add new option to MoneyType

6 participants

@garak@nicolas-grekas@fabpot@yceruto@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp