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] Fix ChoiceType to effectively set and use translator#41534

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:5.3frommarek-binkowski-sim:ticket_41497
Oct 10, 2021

Conversation

@marek-binkowski-sim
Copy link
Contributor

@marek-binkowski-simmarek-binkowski-sim commentedJun 3, 2021
edited by fabpot
Loading

[Component][Form][ChoiceType] constructor line order changed to set translator before early return;

[Component][Form][CoreExtension] a second argument $translator has been added for instantiation of [Component][Form][ChoiceType]

QA
Branch?5.2
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#41497
LicenseMIT
Doc PR-

[Component][Form][ChoiceType] The bug probably came to life after a merge of two commits from different branches: 5.1 and 4.4. The commit in branch 5.1 contained a conditional early return related with the choiceListFactory:

if ($this->choiceListFactoryinstanceof CachingFactoryDecorator) {return;}

The code from the branch 4.4 was there to set the translator, but it wasn't effective when the constructor early returned in the line above.

$this->translator =$translator;

The fix was to switch [Component][Form][ChoiceType] constructor lines related with the translator above the early return related with choiceListFactory.

As a second parameter $translator has been added to the [Component][Form][ChoiceType] constructor, the translator needs to be injected by the CoreExtension so that ChoiceType could set and use it. This is why a second argument is added now in [Component][Form][CoreExtension] loadTypes for Type\ChoiceType:

newType\ChoiceType($this->choiceListFactory,$this->translator),

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 5.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@marek-binkowski-simmarek-binkowski-sim changed the title[Form] Fix ChoiceType Extension to effectively set and use translator[Form] Fix ChoiceType to effectively set and use translatorJun 3, 2021
@carsonbot
Copy link

Hey!

I think@fancyweb has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@marek-binkowski-simmarek-binkowski-simforce-pushed theticket_41497 branch 2 times, most recently from00dc970 to8a3d977CompareJune 9, 2021 20:47
@fabpotfabpot modified the milestones:5.2,5.3Jul 26, 2021
…atorChoiceType constructor line order changed to set translator before early return; CoreExtension injects translator to ChoiceType
@xabbuhxabbuh changed the base branch from5.2 to5.3October 8, 2021 13:09
@stof
Copy link
Member

stof commentedOct 8, 2021

@fabpot why have you asked to revert the constructor typehint ? I don't see the reason to throw a TypeError ourselves instead of letting PHP doing it.

@fabpot
Copy link
Member

@stof Because we are trying to limit the changes done in already released branches.

@fabpot
Copy link
Member

Thank you@marek-binkowski-sim.

@fabpotfabpot merged commitcf8d43e intosymfony:5.3Oct 10, 2021
@marek-binkowski-simmarek-binkowski-sim deleted the ticket_41497 branchOctober 10, 2021 19:56
@fabpotfabpot mentioned this pull requestOct 29, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@xabbuhxabbuhxabbuh approved these changes

@ycerutoycerutoAwaiting requested review from ycerutoyceruto is a code owner

+1 more reviewer

@KocalKocalKocal left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.3

Development

Successfully merging this pull request may close these issues.

6 participants

@marek-binkowski-sim@carsonbot@stof@fabpot@xabbuh@Kocal

[8]ページ先頭

©2009-2025 Movatter.jp