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] ChoiceType: Fix a notice when 'choices' normalizer is replaced#17406

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

@paradajozsef
Copy link
Contributor

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#17270
LicenseMIT
Doc PR-

As@gseidelmentioned, the notice only occurs, when a custom choice field added after a choice fieldand the custom type is expanded,and the'choices' normalizer is replaced. The problem is that when'choices' option is replaced, thedefault choiceNormalizer is not invoked. This normalizer wouldclear the labels from previous invocation, but it's been replaced in the custom choice type. As a result$choiceLabel normalizer will get the wrong labels because it shares the same scope with$choiceNormalizer. Resetting the label values after copy solves this problem.

@xabbuh
Copy link
Member

Can you please add a test to avoid regressions?

@paradajozsef
Copy link
ContributorAuthor

@xabbuh I added a test, which covers this special case and also modified the PR comment a little bit.

@paradajozsefparadajozsef changed the title[Form] Reset choice label values after copy[Form] ChoiceType: Fix a notice when 'choices' normalizer is replacedJan 18, 2016
@fabpot
Copy link
Member

Thank you@paradajozsef.

fabpot added a commit that referenced this pull requestJan 19, 2016
…is replaced (paradajozsef)This PR was squashed before being merged into the 2.7 branch (closes#17406).Discussion----------[Form] ChoiceType: Fix a notice when 'choices' normalizer is replaced| Q             | A| ------------- | ---| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#17270| License       | MIT| Doc PR        | -As@gseidel [mentioned](#17270 (comment)), the notice only occurs, when a custom choice field added after a choice field **and** the custom type is expanded, **and** the ```'choices'``` normalizer is replaced. The problem is that when ```'choices'``` option is replaced, the [default choiceNormalizer](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L262) is not invoked. This normalizer would [clear](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L264) the labels from previous invocation, but it's been replaced in the custom choice type. As a result [$choiceLabel](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L279) normalizer will get the wrong labels because it shares the same scope with [$choiceNormalizer](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php#L262). Resetting the label values after copy solves this problem.Commits-------be056fd [Form] ChoiceType: Fix a notice when 'choices' normalizer is replaced
@fabpotfabpot closed thisJan 19, 2016
@paradajozsefparadajozsef deleted the form-choice-labels-fix branchJanuary 21, 2016 08:08
fabpot added a commit that referenced this pull requestJan 21, 2016
This PR was merged into the 3.1-dev branch.Discussion----------[Form] Make tests compatible with master| Q             | A| ------------- | ---| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -I wrote tests in this PR:#17406 which was compatible only with 2.7.@xabbuh fixed it in 2.8 and 3.0 here:#17463. And this PR fixes deprecated notices in master.Kind of an unfortunate situation...Commits-------96e40b2 Fix unit tests in master
@fabpotfabpot mentioned this pull requestFeb 3, 2016
This was referencedFeb 28, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@paradajozsef@xabbuh@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp