This is how the hidden value is added in the $formBuilder
:
->add('depth', 'hidden', array('mapped'=>false, 'data' => 1))
I have a function that is fired ON_PRE_SUBMIT
, at the line below I assumed this field's value would change but that is not the case.
$form->get('depth')->setData($depth++); //$depth = $form->get('depth')->getData();
I have also tried to do as shown here :
$data = $event->getData();
$data['depth'] = $depth++;
$form->setData($data);
But nothing changes. I have tried the above codes on other fields and they change the fields values normally. Am I missing something?