File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Tests/Extension/DataCollector Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -123,9 +123,13 @@ public function extractSubmittedData(FormInterface $form)
123
123
*/
124
124
public function extractViewVariables (FormView $ view )
125
125
{
126
- $ data = array (
127
- 'id ' => $ view ->vars ['id ' ]
128
- );
126
+ $ data = array ();
127
+
128
+ // Set the ID in case no FormInterface object was collected for this
129
+ // view
130
+ if (isset ($ view ->vars ['id ' ])) {
131
+ $ data ['id ' ] = $ view ->vars ['id ' ];
132
+ }
129
133
130
134
foreach ($ view ->vars as $ varName => $ value ) {
131
135
$ data ['view_vars ' ][$ varName ] = $ this ->valueExporter ->exportValue ($ value );
Original file line number Diff line number Diff line change @@ -352,13 +352,16 @@ public function testExtractViewVariables()
352
352
'b ' => 'foo ' ,
353
353
'a ' => 'bar ' ,
354
354
'c ' => 'baz ' ,
355
+ 'id ' => 'foo_bar ' ,
355
356
);
356
357
357
358
$ this ->assertSame (array (
359
+ 'id ' => 'foo_bar ' ,
358
360
'view_vars ' => array (
359
361
'a ' => "'bar' " ,
360
362
'b ' => "'foo' " ,
361
363
'c ' => "'baz' " ,
364
+ 'id ' => "'foo_bar' " ,
362
365
),
363
366
), $ this ->dataExtractor ->extractViewVariables ($ view ));
364
367
}
You can’t perform that action at this time.
0 commit comments