CraueFormFlow start in a given step

261 views Asked by At

I have a Symfony 3.4 application with Craue Form Flow and I need to be able to start the flow (in some cases) on a given step (not step 1).

is there a way to do that? I have dynamic step navigation enabled.

thanks

EDIT:

When using the dynamic navigation I noticed the change in the URL. It includes the instance code and the step number, something like this:

MY_URL/MY_PAGE&instance=7yCRU0UkfM&step=4

I was able to get the Instance code with

$_POST['flow_createProposal_instance'];

and then recreated the route and did a redirectToRoute but it starts on step 1.

1

There are 1 answers

0
Jon On

I managed to do it by adding the data to the currentRequest, saving the form and then going to the next step

$currentRequest = $this->requestStack->getCurrentRequest();
$currentRequest->request->set('Step1', $step1Data);
$this->flow->saveCurrentStepData($form);
$this->flow->nextStep();

I repeat this for each step i need to "skip". The $step1Data variable is simply an associative array with the values I need to save per step.