Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b3b1c45

Browse files
committed
minor #14825 Documenting how to keep option value BC - see #14377 (weaverryan)
This PR was merged into the 2.7 branch. Discussion ---------- Documenting how to keep option value BC - see #14377 | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #14377 (kinda) | License | MIT | Doc PR | symfony/symfony-docs#5179 Hi guys! I'm still making sense of the form changes, but it seems that this before and after isn't totally honest - your option values will change, unless your add this extra option. @webmozart look correct to you? Thanks! Commits ------- deb9db8 Documenting how to keep option value BC - see #14377
2 parents e7e48c8 + deb9db8 commit b3b1c45

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

UPGRADE-2.7.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ Form
134134
'Ignored' => Status::IGNORED,
135135
),
136136
'choices_as_values' => true,
137+
// important if you rely on your option value attribute (e.g. for JavaScript)
138+
// this will keep the same functionality as before
139+
'choice_value' => function ($choice) {
140+
return $choice;
141+
},
137142
));
138143
```
139144

0 commit comments

Comments
 (0)