File tree Expand file tree Collapse file tree 2 files changed +52
-1
lines changed Expand file tree Collapse file tree 2 files changed +52
-1
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,14 @@ public function onKernelRequest(RequestEvent $event): void
117
117
$ attributes = [];
118
118
119
119
foreach ($ parameters as $ parameter => $ value ) {
120
- $ attribute = $ mapping [$ parameter ] ?? $ parameter ;
120
+ if (!isset ($ mapping [$ parameter ])) {
121
+ $ attribute = $ parameter ;
122
+ } elseif (\is_array ($ mapping [$ parameter ])) {
123
+ [$ attribute , $ parameter ] = $ mapping [$ parameter ];
124
+ $ mappedAttributes [$ attribute ] = '' ;
125
+ } else {
126
+ $ attribute = $ mapping [$ parameter ];
127
+ }
121
128
122
129
if (!isset ($ mappedAttributes [$ attribute ])) {
123
130
$ attributes [$ attribute ] = $ value ;
Original file line number Diff line number Diff line change @@ -323,5 +323,49 @@ public static function provideRouteMapping(): iterable
323
323
],
324
324
],
325
325
];
326
+
327
+ yield [
328
+ [
329
+ 'conference ' => ['slug ' => 'vienna-2024 ' ],
330
+ ],
331
+ [
332
+ 'slug ' => 'vienna-2024 ' ,
333
+ '_route_mapping ' => [
334
+ 'slug ' => [
335
+ 'conference ' ,
336
+ 'slug ' ,
337
+ ],
338
+ ],
339
+ ],
340
+ ];
341
+
342
+ yield [
343
+ [
344
+ 'article ' => [
345
+ 'id ' => 'abc123 ' ,
346
+ 'date ' => '2024-04-24 ' ,
347
+ 'slug ' => 'symfony-rocks ' ,
348
+ ],
349
+ ],
350
+ [
351
+ 'id ' => 'abc123 ' ,
352
+ 'date ' => '2024-04-24 ' ,
353
+ 'slug ' => 'symfony-rocks ' ,
354
+ '_route_mapping ' => [
355
+ 'id ' => [
356
+ 'article ' ,
357
+ 'id '
358
+ ],
359
+ 'date ' => [
360
+ 'article ' ,
361
+ 'date ' ,
362
+ ],
363
+ 'slug ' => [
364
+ 'article ' ,
365
+ 'slug ' ,
366
+ ],
367
+ ],
368
+ ],
369
+ ];
326
370
}
327
371
}
You can’t perform that action at this time.
0 commit comments