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] [MoneyType] Add "input" option#50720

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

Closed

Conversation

@BASAKSemih
Copy link
Contributor

@BASAKSemihBASAKSemih commentedJun 20, 2023
edited
Loading

QA
Branch?6.4
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#50707
LicenseMIT
Doc PR- WIP

@carsonbotcarsonbot added this to the6.4 milestoneJun 20, 2023
@carsonbotcarsonbot changed the title[Form][MoneyType] Add "format" options[Form] [MoneyType] Add "format" optionsJun 20, 2023
@BASAKSemihBASAKSemih changed the title[Form] [MoneyType] Add "format" options[Form] [MoneyType] Add "input" optionJun 22, 2023
'currency' =>'EUR',
'compound' =>false,
'html5' =>false,
'scale'=>2,
Copy link
Member

Choose a reason for hiding this comment

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

the codestyle changes have to be reverted

$this->assertSame(12345,$form->getData());
}

publicfunctiontestInputTypeIntegerAndDivisorNotEgalToOne()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
publicfunctiontestInputTypeIntegerAndDivisorNotEgalToOne()
publicfunctiontestInputTypeIntegerAndDivisorNotEqualToOne()

publicfunctiontestValueToIntegerWithSpecificOptionInputToInteger()
{
$form =$this->factory->create(static::TESTED_TYPE,null, ['input' =>'integer']);
$form->submit('12345.6');
Copy link
Member

Choose a reason for hiding this comment

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

IMO this case should trigger an exception in duringreverseTransform()


publicfunctiontestHtml5EnablesSpecificFormattingWithIntegerFormat()
{
$form =$this->factory->create(static::TESTED_TYPE,null, ['html5' =>true,'scale' =>2,'input' =>'integer']);
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure that a scale option with a value other than0 plays well with how theinput option is implemented currently.

But, this makes me wonder if the way this option is currently implemented actually makes sense. So maybe we should indeed allow thedivision to be greater than 1 and take it into account to decide whether we want to render anumber or aninteger widget.

Copy link
Member

@javiereguiluzjaviereguiluz left a comment

Choose a reason for hiding this comment

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

I like this feature, but I wonder about the new option name:input sounds too generic.

Just wondering: since we have other options calledmodel_* (e.g.model_timezone in nhttps://symfony.com/doc/current/reference/forms/types/datetime.html#model-timezone). Should we rename this option to follow that pattern? Some ideas:

model_formattingmodel_formatmodel_data_type...

@fabpot
Copy link
Member

@BASAKSemih Do you have time to take comments into account?

@BASAKSemih
Copy link
ContributorAuthor

@BASAKSemih Do you have time to take comments into account?

No sorry i don't have time

@fabpot
Copy link
Member

Thank you for your answer. Let’s close for now then. Maybe someone will take over.

@fabpotfabpot closed thisOct 5, 2023
@BASAKSemihBASAKSemih deleted the MoneyType/addFormatOption branchNovember 24, 2023 11:38
fabpot added a commit that referenced this pull requestDec 29, 2023
This PR was squashed before being merged into the 7.1 branch.Discussion----------[Form] add "model_type" option to MoneyType| Q             | A| ------------- | ---| Branch?       | 7.1| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       |Fix#50707| License       | MITThis is a replacement for abandoned#50720Please 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.Commits-------8811741 [Form] add "model_type" option to MoneyType
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@xabbuhxabbuhxabbuh left review comments

@ycerutoycerutoAwaiting requested review from ycerutoyceruto is a code owner

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

Add new option to MoneyType

5 participants

@BASAKSemih@fabpot@javiereguiluz@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp