Symfony: Access form collection variables from the parent form

This usually goes in the controller after checking if the form submitted is valid:

// Accessing the request vars works this way:
$formSubmit = $request->request->get(‘parentForm’);
$formEntity1 = $formSubmit['entity1'];

$formEntity2 = $formSubmit['entity2']; // This accesses other sub form object for more unmapped vars

$entity1_property = $formEntity1[0]['property_field_name'];
$entity2_property= $forEntity2[0]['property_field_name'];

Leave a Reply 0

Your email address will not be published. Required fields are marked *