Skip to content

Commit

Permalink
Fixed error in multiple steps example
Browse files Browse the repository at this point in the history
  • Loading branch information
derhansen committed May 4, 2013
1 parent 4c9dd8f commit 05855fe
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Classes/Controller/MultipleStepsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand All @@ -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'));
}

Expand Down Expand Up @@ -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'));
}

Expand Down Expand Up @@ -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();

Expand All @@ -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));
}
}
Expand Down

0 comments on commit 05855fe

Please sign in to comment.