I want one hidden field in my symfony form without an prefix. This field stores some information I needed to recreate the form type in my listener. I dont want to iterate over all $request
parameters to get the right form so I want add simple field without any prefix. This need to be handled in the form builder, because the Frontend is not part of the bundle.
Current simplified code:
$builder->add('firstName'; TextType::class);
$builder->add('lastName'; TextType::class);
// ...
// field without prefix
$builder->add('someValue', HiddenType::class, ['mapped' => false]);
Expected result:
<input type="text" name="form_name[firstName]" />
<input type="text" name="form_name[lastName]" />
<!-- ... -->
<input type="hidden" name="someValue" /> <!-- without prefix -->
The thing is I need to access it with $request->request->get('someValue')
. Because my form name is dynamically I cant access the array.
Is this possible?