[TASK] Extbase: Traverse validation results until first error 89/35389/2
authorSteffen Müller <typo3@t3node.com>
Sat, 13 Dec 2014 15:11:31 +0000 (16:11 +0100)
committerSteffen Müller <typo3@t3node.com>
Sat, 13 Dec 2014 15:15:57 +0000 (16:15 +0100)
When deciding whether to call the action method or error method it's
sufficient to traverse results until the first error.
To improve performance break the foreach on first
found (not ignored) error.

Resolves: #63726
Releases: master, 6.2
Change-Id: I988cb5c8ac20518c359db75bb46fe6702c549cf6
Reviewed-on: http://review.typo3.org/35389
Reviewed-by: Steffen Müller <typo3@t3node.com>
Tested-by: Steffen Müller <typo3@t3node.com>
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php

index 47ace0b..66ed87e 100644 (file)
@@ -290,7 +290,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                                if (isset($methodTagsValues['ignorevalidation'])) {
                                        $ignoreValidationAnnotations = $methodTagsValues['ignorevalidation'];
                                }
-                               // if there exists more errors than in ignoreValidationAnnotations_=> call error method
+                               // if there exist errors which are not ignored with @ignorevalidation => call error method
                                // else => call action method
                                $shouldCallActionMethod = TRUE;
                                foreach ($validationResult->getSubResults() as $argumentName => $subValidationResult) {
@@ -301,6 +301,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                                                continue;
                                        }
                                        $shouldCallActionMethod = FALSE;
+                                       break;
                                }
                                if ($shouldCallActionMethod) {
                                        $this->emitBeforeCallActionMethodSignal($preparedArguments);