Example #1
0
 /**
  * @param ProcessInterface $process
  * @param $result
  *
  * @return RedirectResponse
  */
 public function processStepResult(ProcessInterface $process, $result)
 {
     if ($result instanceof Response || $result instanceof View) {
         return $result;
     }
     if ($result instanceof ActionResult) {
         // Handle explicit jump to step.
         if ($result->getNextStepName()) {
             $this->context->setNextStepByName($result->getNextStepName());
             return $this->redirectToStepDisplayAction($process, $this->context->getNextStep());
         }
         // Handle last step.
         if ($this->context->isLastStep()) {
             $this->context->close();
             return new RedirectResponse($this->router->generate($process->getRedirect(), $process->getRedirectParams()));
         }
         // Handle default linear behaviour.
         return $this->redirectToStepDisplayAction($process, $this->context->getNextStep());
     }
     throw new \RuntimeException('Wrong action result, expected Response or ActionResult');
 }