Open ericjacolin opened 4 years ago
You could use the method getStepData($stepNumber) for a specific step data or retrieveStepData() for all the data and pass it to the form options.
public function getFormOptions($step, array $options = array()) {
$options = parent::getFormOptions($step, $options);
$formData = $this->getFormData();
switch ($step) {
case 1:
$options['validation_groups'] = 'step_1';
$options['em'] = $this->em;
break;
case 2:
$options['validation_groups'] = 'step_2';
$options['em'] = $this->em;
$options['data']['container'] = $this->container;
$steps = $this->retrieveStepData();
$options['data']['steps'] = $steps;
break;
}
return $options;
}
I understand that the philosophy of the package is that the form flow is bind'ed to an entity object, that's great. So form flow data can only be accessed through the entity getters. However in practice for complex dynamic forms I find I often have to add convenience unmapped fields. It would be nice to be able to access them too. The session formflow object seem to represent steps in a hashmap keyed by a random base64 key, those include unmapped fields, but they can't seem to be accessed. The workaround I use is to store these unmapped fields in the user session for reuse in later steps, but it is not very clean.