Task #83475

Aggregate validator information in class schema

Added by Alexander Schnitzler over 1 year ago. Updated 9 months ago.

Status:
Closed
Priority:
Should have
Category:
Extbase
Target version:
Start date:
2018-01-04
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Sprint Focus:

Associated revisions

Revision 84879ed4 (diff)
Added by Alexander Schnitzler about 1 year ago

[!!!][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 <>
Tested-by: Christian Kuhn <>
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>

History

#1 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55261

#2 Updated by Gerrit Code Review over 1 year ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55261

#3 Updated by Oliver Hader over 1 year ago

  • Target version changed from 9.1 to 9.2

#4 Updated by Gerrit Code Review over 1 year ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55261

#5 Updated by Gerrit Code Review about 1 year ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55261

#6 Updated by Anonymous about 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#7 Updated by Benni Mack 9 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF