Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function forward($scenarioAlias, $stepName)
 {
     $process = $this->buildProcess($scenarioAlias);
     $step = $process->getStepByName($stepName);
     $this->context->initialize($process, $step);
     $this->context->rewindHistory();
     return $this->processStepResult($process, $this->context->isValid() ? $step->forwardAction($this->context) : $this->context->getProcess()->getValidator()->getResponse($step));
 }
 /**
  * {@inheritdoc}
  */
 public function forward($scenarioAlias, $stepName)
 {
     $process = $this->buildProcess($scenarioAlias);
     $step = $process->getStepByName($stepName);
     $this->context->initialize($process, $step);
     $this->context->rewindHistory();
     if (($validator = $this->context->isValid()) !== true) {
         return $validator->getResponse($step);
     }
     $result = $step->forwardAction($this->context);
     return $this->processStepResult($process, $result);
 }
Esempio n. 3
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);
 }