Permalink
Browse files

Fixed error in multiple steps example

  • Loading branch information...
derhansen committed May 4, 2013
1 parent 4c9dd8f commit 05855fe623845081bc8817e8369fffab11c307e1
Showing with 10 additions and 5 deletions.
  1. +10 −5 Classes/Controller/MultipleStepsController.php
@@ -75,7 +75,7 @@ public function injectApiService(Tx_ValidationExamples_Service_ExternalApiServic
*/
public function step1Action(Tx_ValidationExamples_Domain_Model_Step1Data $step1data = NULL) {
/* Check if step1data is available in session */
if ($GLOBALS['TSFE']->fe_user->getKey('ses', 'step1data')) {
if ($GLOBALS['TSFE']->fe_user->getKey('ses', 'step1data') && $step1data == NULL) {
$step1data = unserialize($GLOBALS['TSFE']->fe_user->getKey('ses', 'step1data'));
}
@@ -102,7 +102,7 @@ public function step1redirectAction(Tx_ValidationExamples_Domain_Model_Step1Data
*/
public function step2Action(Tx_ValidationExamples_Domain_Model_Step2Data $step2data = NULL) {
/* Check if step2data is available in session */
if ($GLOBALS['TSFE']->fe_user->getKey('ses', 'step2data')) {
if ($GLOBALS['TSFE']->fe_user->getKey('ses', 'step2data') && $step2data == NULL) {
$step2data = unserialize($GLOBALS['TSFE']->fe_user->getKey('ses', 'step2data'));
}
@@ -133,7 +133,7 @@ public function step2redirectAction(Tx_ValidationExamples_Domain_Model_Step2Data
*/
public function step3Action(Tx_ValidationExamples_Domain_Model_Step3Data $step3data = NULL) {
/* Check if step3data is available in session */
if ($GLOBALS['TSFE']->fe_user->getKey('ses', 'step3data')) {
if ($GLOBALS['TSFE']->fe_user->getKey('ses', 'step3data') && $step3data == NULL) {
$step3data = unserialize($GLOBALS['TSFE']->fe_user->getKey('ses', 'step3data'));
}
@@ -235,7 +235,12 @@ protected function setApiValidationErrors($step) {
$apiresults = $GLOBALS['TSFE']->fe_user->getKey('ses', 'apiresults');
if (array_key_exists($step, $apiresults)) {
/* Set Form Errors manually */
$errors = new Tx_Extbase_MVC_Controller_ArgumentError($step . 'data');
$origErrors = $this->controllerContext->getRequest()->getErrors();
if ($origErrors) {
$errors = $origErrors[$step . 'data'];
} else {
$errors = new Tx_Extbase_MVC_Controller_ArgumentError($step . 'data');
}
$propertyErrors = array();
@@ -246,8 +251,8 @@ protected function setApiValidationErrors($step) {
$propertyError = t3lib_div::makeInstance('Tx_Extbase_Validation_Error', $message, time());
$propertyErrors[$key]->addErrors(array($propertyError));
}
$errors->addErrors($propertyErrors);
$this->controllerContext->getRequest()->setErrors(array($errors));
}
}

0 comments on commit 05855fe

Please sign in to comment.