Commit 76e265c
committed
[Form] refactor CheckboxListMapper and RadioListMapper
fixes #14712 and #17789.
`ChoiceType` now always use `ChoiceToValueTransformer` or
`ChoicesToValuesTransformer` depending on `multiple` option.
Hence `CheckboxListMapper` and `RadioListMapper` don’t handle
the transformation anymore.
Fixes pre selection of choice with model values such as `null`,
`false` or empty string.1 parent 4842984 commit 76e265cCopy full SHA for 76e265c
File tree
Expand file treeCollapse file tree
5 files changed
+76
-78
lines changedOpen diff view settings
Filter options
- src/Symfony
- Bridge/Doctrine/Tests/Form/Type
- Component/Form
- Extension/Core
- DataMapper
- Type
- Tests/Extension/Core/Type
Expand file treeCollapse file tree
5 files changed
+76
-78
lines changedOpen diff view settings
Collapse file
src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
261 | 261 | |
262 | 262 | |
263 | 263 | |
264 | | - |
| 264 | + |
265 | 265 | |
266 | 266 | |
267 | 267 | |
|
Collapse file
src/Symfony/Component/Form/Extension/Core/DataMapper/CheckboxListMapper.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/DataMapper/CheckboxListMapper.php+8-32Lines changed: 8 additions & 32 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
11 | 11 | |
12 | 12 | |
13 | 13 | |
14 | | - |
15 | 14 | |
16 | 15 | |
| 16 | + |
17 | 17 | |
18 | 18 | |
19 | 19 | |
| ||
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | 29 | |
40 | 30 | |
41 | 31 | |
| ||
46 | 36 | |
47 | 37 | |
48 | 38 | |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | | - |
55 | | - |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
| 39 | + |
60 | 40 | |
61 | 41 | |
62 | 42 | |
63 | 43 | |
64 | | - |
| 44 | + |
65 | 45 | |
66 | 46 | |
67 | 47 | |
| ||
70 | 50 | |
71 | 51 | |
72 | 52 | |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
73 | 57 | |
74 | 58 | |
75 | 59 | |
| ||
79 | 63 | |
80 | 64 | |
81 | 65 | |
82 | | - |
83 | | - |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | | - |
89 | | - |
90 | | - |
| 66 | + |
91 | 67 | |
92 | 68 | |
Collapse file
src/Symfony/Component/Form/Extension/Core/DataMapper/RadioListMapper.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/DataMapper/RadioListMapper.php+11-16Lines changed: 11 additions & 16 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
11 | 11 | |
12 | 12 | |
13 | 13 | |
14 | | - |
15 | 14 | |
| 15 | + |
16 | 16 | |
17 | 17 | |
18 | 18 | |
| ||
25 | 25 | |
26 | 26 | |
27 | 27 | |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | 28 | |
39 | 29 | |
40 | 30 | |
41 | 31 | |
42 | 32 | |
43 | | - |
| 33 | + |
| 34 | + |
| 35 | + |
44 | 36 | |
45 | 37 | |
46 | 38 | |
47 | | - |
| 39 | + |
48 | 40 | |
49 | 41 | |
50 | 42 | |
| ||
53 | 45 | |
54 | 46 | |
55 | 47 | |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
56 | 52 | |
57 | 53 | |
58 | 54 | |
| ||
61 | 57 | |
62 | 58 | |
63 | 59 | |
64 | | - |
65 | | - |
| 60 | + |
66 | 61 | |
67 | | - |
| 62 | + |
68 | 63 | |
69 | 64 | |
70 | 65 | |
|
Collapse file
src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php+10-15Lines changed: 10 additions & 15 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | | - |
65 | | - |
| 64 | + |
| 65 | + |
66 | 66 | |
67 | 67 | |
68 | 68 | |
| ||
133 | 133 | |
134 | 134 | |
135 | 135 | |
| 136 | + |
136 | 137 | |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
141 | | - |
142 | | - |
143 | | - |
144 | | - |
145 | | - |
146 | | - |
147 | | - |
| 138 | + |
148 | 139 | |
149 | 140 | |
150 | 141 | |
151 | | - |
| 142 | + |
152 | 143 | |
153 | 144 | |
154 | 145 | |
| ||
247 | 238 | |
248 | 239 | |
249 | 240 | |
250 | | - |
| 241 | + |
| 242 | + |
| 243 | + |
| 244 | + |
| 245 | + |
251 | 246 | |
252 | 247 | |
253 | 248 | |
|
Collapse file
src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php+46-14Lines changed: 46 additions & 14 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
32 | 32 | |
33 | 33 | |
34 | 34 | |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
35 | 41 | |
36 | 42 | |
37 | 43 | |
| ||
183 | 189 | |
184 | 190 | |
185 | 191 | |
| 192 | + |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
| 203 | + |
| 204 | + |
186 | 205 | |
187 | 206 | |
188 | 207 | |
| ||
197 | 216 | |
198 | 217 | |
199 | 218 | |
| 219 | + |
| 220 | + |
| 221 | + |
| 222 | + |
| 223 | + |
| 224 | + |
| 225 | + |
| 226 | + |
| 227 | + |
| 228 | + |
| 229 | + |
| 230 | + |
| 231 | + |
200 | 232 | |
201 | 233 | |
202 | 234 | |
| ||
319 | 351 | |
320 | 352 | |
321 | 353 | |
322 | | - |
| 354 | + |
323 | 355 | |
324 | 356 | |
325 | 357 | |
| ||
940 | 972 | |
941 | 973 | |
942 | 974 | |
943 | | - |
| 975 | + |
944 | 976 | |
945 | 977 | |
946 | 978 | |
| ||
972 | 1004 | |
973 | 1005 | |
974 | 1006 | |
975 | | - |
| 1007 | + |
976 | 1008 | |
977 | 1009 | |
978 | 1010 | |
| ||
990 | 1022 | |
991 | 1023 | |
992 | 1024 | |
993 | | - |
| 1025 | + |
994 | 1026 | |
995 | 1027 | |
996 | 1028 | |
| ||
1022 | 1054 | |
1023 | 1055 | |
1024 | 1056 | |
1025 | | - |
| 1057 | + |
1026 | 1058 | |
1027 | 1059 | |
1028 | 1060 | |
| ||
1040 | 1072 | |
1041 | 1073 | |
1042 | 1074 | |
1043 | | - |
| 1075 | + |
1044 | 1076 | |
1045 | 1077 | |
1046 | 1078 | |
| ||
1072 | 1104 | |
1073 | 1105 | |
1074 | 1106 | |
1075 | | - |
| 1107 | + |
1076 | 1108 | |
1077 | 1109 | |
1078 | 1110 | |
| ||
1090 | 1122 | |
1091 | 1123 | |
1092 | 1124 | |
1093 | | - |
| 1125 | + |
1094 | 1126 | |
1095 | 1127 | |
1096 | 1128 | |
| ||
1124 | 1156 | |
1125 | 1157 | |
1126 | 1158 | |
1127 | | - |
| 1159 | + |
1128 | 1160 | |
1129 | 1161 | |
1130 | 1162 | |
| ||
1142 | 1174 | |
1143 | 1175 | |
1144 | 1176 | |
1145 | | - |
| 1177 | + |
1146 | 1178 | |
1147 | 1179 | |
1148 | 1180 | |
| ||
1176 | 1208 | |
1177 | 1209 | |
1178 | 1210 | |
1179 | | - |
| 1211 | + |
1180 | 1212 | |
1181 | 1213 | |
1182 | 1214 | |
| ||
1194 | 1226 | |
1195 | 1227 | |
1196 | 1228 | |
1197 | | - |
| 1229 | + |
1198 | 1230 | |
1199 | 1231 | |
1200 | 1232 | |
| ||
1228 | 1260 | |
1229 | 1261 | |
1230 | 1262 | |
1231 | | - |
| 1263 | + |
1232 | 1264 | |
1233 | 1265 | |
1234 | 1266 | |
| ||
1247 | 1279 | |
1248 | 1280 | |
1249 | 1281 | |
1250 | | - |
| 1282 | + |
1251 | 1283 | |
1252 | 1284 | |
1253 | 1285 | |
|
0 commit comments