Skip to content
Snippets Groups Projects
Commit 84879ed4 authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Frank Naegler
Browse files

[!!!][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: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
parent b9026a9f
Showing
with 639 additions and 52 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment