Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function display($scenarioAlias, $stepName, ParameterBag $queryParameters = null)
 {
     $process = $this->buildProcess($scenarioAlias);
     $step = $process->getStepByName($stepName);
     $this->context->initialize($process, $step);
     try {
         $this->context->rewindHistory();
     } catch (NotFoundHttpException $e) {
         //the step we are supposed to display was not found in the history.
         if (null === $this->context->getPreviousStep()) {
             //there is no previous step go to start
             return $this->start($scenarioAlias, $queryParameters);
         }
         //we will go back to previous step...
         $history = $this->context->getStepHistory();
         if (empty($history)) {
             //there is no history
             return $this->start($scenarioAlias);
         }
         $step = $process->getStepByName(end($history));
         $this->context->initialize($process, $step);
         return $this->redirectToStepDisplayAction($process, $step);
     }
     if (!$this->context->isValid()) {
         return $this->context->getProcess()->getValidator()->getResponse($step);
     }
     $result = $step->displayAction($this->context);
     return $this->processStepResult($process, $result);
 }
Beispiel #2
0
 /**
  * @param ProcessInterface $process
  * @param string           $scenarioAlias
  *
  * @return RedirectResponse
  */
 protected function goToLastValidStep(ProcessInterface $process, $scenarioAlias)
 {
     //the step we are supposed to display was not found in the history.
     if (null === $this->context->getPreviousStep()) {
         //there is no previous step go to start
         return $this->start($scenarioAlias);
     }
     //we will go back to previous step...
     $history = $this->context->getStepHistory();
     if (empty($history)) {
         //there is no history
         return $this->start($scenarioAlias);
     }
     $step = $process->getStepByName(end($history));
     $this->context->initialize($process, $step);
     return $this->redirectToStepDisplayAction($process, $step);
 }