protected function processFlow($formData, FormFlow $flow)
 {
     $flow->bind($formData);
     $form = $flow->createForm();
     if ($flow->isValid($form)) {
         $flow->saveCurrentStepData($form);
         if ($flow->nextStep()) {
             // create form for next step
             $form = $flow->createForm();
         } else {
             // flow finished
             $flow->reset();
             return new JsonResponse($formData);
         }
     }
     return array('form' => $form->createView(), 'flow' => $flow, 'formData' => $formData);
 }
 /**
  * {@inheritDoc}
  */
 public function bind($formData)
 {
     $this->dataManager->getStorage()->set($this->getCalledEventsSessionKey(), array());
     parent::bind($formData);
 }
 protected function processFlow($formData, FormFlow $flow, $template = 'IntegrationTestBundle::layout_flow.html.twig')
 {
     $flow->bind($formData);
     $form = $submittedForm = $flow->createForm();
     if ($flow->isValid($submittedForm)) {
         $flow->saveCurrentStepData($submittedForm);
         if ($flow->nextStep()) {
             // create form for next step
             $form = $flow->createForm();
         } else {
             // flow finished
             $flow->reset();
             return new JsonResponse($formData);
         }
     }
     if ($flow->redirectAfterSubmit($submittedForm)) {
         $request = $this->getCurrentRequest();
         $params = $this->get('craue_formflow_util')->addRouteParameters(array_merge($request->query->all(), $request->attributes->get('_route_params')), $flow);
         return $this->redirect($this->generateUrl($request->attributes->get('_route'), $params));
     }
     return $this->render($template, array('form' => $form->createView(), 'flow' => $flow, 'formData' => $formData));
 }