[!!!][TASK] Aggregate validator information in class schema
This is the first part of many to streamline the resolving of validators. In this patch, the following changes: - The class schema aggregates all the information about validators that are added via @validate annotations. As reflection is involved here, it makes sense to put this into the class schema generation and remove it from the ActionController. - Along with this change there have been changes to the ValidatorResolver class. Being references only in the ActionController, buildMethodArgumentsValidatorConjunctions has been deprecated and is no longer used by the core itself. - Also, the methods parseValidatorAnnotation and resolveValidatorObjectName have been made public as they are now used from outside the ValidatorResolver class. The main achievements of this patch are getting rid of runtime reflection by the ActionController and fetching the necessary information about validators from the class schema, which at this very moment, is also generated during runtime but is cached and that cache can be warmed up in the future. Therefore this change does also improve the runtime performance of Extbase a bit. This patch is considered breaking as it removes the support for adding validators to properties of method arguments via the following (quite unknown) semantic sugar. /* * @param Model $model * @validate $model.property NotEmpty */ public function foo(Model $model){} This possibility is quite unknown and unused in the wild and as it eases the aggregation of validators it will be removed without any replacement. However, whenever a model is validated and a model validator exists for that model, it will be registered and called automatically. If not dealing with models but regular objects or arrays, the recommended way is to write a custom validator and do the validation manually in that class. Releases: master Resolves: #83475 Change-Id: I3c76e722fe084e8346bb27ea5ba8c7ef0f056eda Reviewed-on: https://review.typo3.org/55261 Reviewed-by:Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by:
Frank Naegler <frank.naegler@typo3.org> Tested-by:
Frank Naegler <frank.naegler@typo3.org>
Showing
- typo3/sysext/core/Documentation/Changelog/master/Breaking-83475-AggregateValidatorInformationInClassSchema.rst 55 additions, 0 deletions...king-83475-AggregateValidatorInformationInClassSchema.rst
- typo3/sysext/core/Documentation/Changelog/master/Deprecation-83475-AggregateValidatorInformationInClassSchema-1.rst 41 additions, 0 deletions...on-83475-AggregateValidatorInformationInClassSchema-1.rst
- typo3/sysext/core/Documentation/Changelog/master/Deprecation-83475-AggregateValidatorInformationInClassSchema-2.rst 32 additions, 0 deletions...on-83475-AggregateValidatorInformationInClassSchema-2.rst
- typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php 33 additions, 15 deletions...ysext/extbase/Classes/Mvc/Controller/ActionController.php
- typo3/sysext/extbase/Classes/Reflection/ClassSchema.php 73 additions, 7 deletionstypo3/sysext/extbase/Classes/Reflection/ClassSchema.php
- typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php 11 additions, 2 deletions...3/sysext/extbase/Classes/Validation/ValidatorResolver.php
- typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php 108 additions, 10 deletions.../sysext/extbase/Tests/Unit/Reflection/ClassSchemaTest.php
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyController.php 44 additions, 0 deletions...extbase/Tests/Unit/Reflection/Fixture/DummyController.php
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyControllerWithValidateAnnotationWithoutParam.php 6 additions, 18 deletions...ure/DummyControllerWithValidateAnnotationWithoutParam.php
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyControllerWithValidateAnnotationWithoutParamTypeHint.php 30 additions, 0 deletions...yControllerWithValidateAnnotationWithoutParamTypeHint.php
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyModel.php 11 additions, 0 deletions...sext/extbase/Tests/Unit/Reflection/Fixture/DummyModel.php
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/Validation/Validator/DummyValidator.php 41 additions, 0 deletions...eflection/Fixture/Validation/Validator/DummyValidator.php
- typo3/sysext/extbase/Tests/Unit/Reflection/ReflectionServiceTest.php 3 additions, 0 deletions...t/extbase/Tests/Unit/Reflection/ReflectionServiceTest.php
- typo3/sysext/extbase/Tests/UnitDeprecated/Validation/ValidatorResolverTest.php 137 additions, 0 deletions...Tests/UnitDeprecated/Validation/ValidatorResolverTest.php
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php 7 additions, 0 deletions.../Configuration/ExtensionScanner/Php/MethodCallMatcher.php
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php 7 additions, 0 deletions...guration/ExtensionScanner/Php/MethodCallStaticMatcher.php
Please register or sign in to comment