[BUGFIX] Add domain model validators only once 15/36915/2
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Sat, 14 Feb 2015 22:04:48 +0000 (23:04 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Fri, 20 Feb 2015 10:04:26 +0000 (11:04 +0100)
If a domain model validator is present and a controller
action accepts this domain model as argument, the validator
is added twice to the validation tree.

It is added in
ValidatorResolver::buildMethodArgumentsValidatorConjunctions()
and in ValidatorResolver::addCustomValidators() which is called
from ValidatorResolver::getBaseValidatorConjunction()

Both methods are called when building the validation tree in
ActionController::initializeActionMethodValidators()

Resolves: #52607
Releases: master, 6.2
Change-Id: Ic1674bacfb027840d9b8fcd1d66586ebb0e75ad6
Reviewed-on: http://review.typo3.org/36915
Reviewed-by: Patrick Schriner <patrick.schriner@diemedialen.de>
Tested-by: Patrick Schriner <patrick.schriner@diemedialen.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Andy Grunwald <andygrunwald@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php

index 01a47d3..6321470 100644 (file)
@@ -158,9 +158,6 @@ class ValidatorResolver implements \TYPO3\CMS\Core\SingletonInterface {
                        // @todo: remove check for old underscore model name syntax once it's possible
                        if (strpbrk($methodParameter['type'], '_\\') === FALSE) {
                                $typeValidator = $this->createValidator($methodParameter['type']);
-                       } elseif (preg_match('/[\\_]Model[\\_]/', $methodParameter['type']) !== FALSE) {
-                               $possibleValidatorClassName = str_replace(array('\\Model\\', '_Model_'), array('\\Validator\\', '_Validator_'), $methodParameter['type']) . 'Validator';
-                               $typeValidator = $this->createValidator($possibleValidatorClassName);
                        } else {
                                $typeValidator = NULL;
                        }