Exemplo n.º 1
0
 /**
  * @param SubmitButton $button
  */
 public function submitStep(SubmitButton $button)
 {
     $form = $button->getForm();
     $submitName = $button->getName();
     if ($submitName === self::PREV_SUBMIT_NAME) {
         $currentStep = $this->getCurrentStep();
         $this->getSection()->currentStep = $currentStep - 1;
     } else {
         if ($submitName === self::NEXT_SUBMIT_NAME && $form->isValid()) {
             $this->merge($form->getValues(TRUE));
             $this->getSection()->lastStep = $this->getSection()->currentStep = $this->getCurrentStep() + 1;
         } else {
             if ($submitName === self::FINISH_SUBMIT_NAME && $form->isValid() && $this->getSection()->values !== NULL) {
                 $this->merge($form->getValues(TRUE));
                 $this->isSuccess = TRUE;
                 $this->finish();
                 foreach ($this->onSuccess as $callback) {
                     $callback($this);
                 }
                 $this->resetSection();
             }
         }
     }
 }