Task #87957

Do not magically register validators

Added by Alexander Schnitzler 9 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2019-03-19
Due date:
% Done:

100%

TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Sprint Focus:

Associated revisions

Revision 7f21ba47 (diff)
Added by Alexander Schnitzler 6 months ago

[!!!][TASK] Do not magically register validators

This patch removes the automatical registration of two types
of validators.

- model validators
- type validators

Model validators are those validators that follow a specific
namespace and class naming derived from domain models.

Given a model \Vendor\Extension\Domain\Model\Foo, extbase searched
for a valiator \Vendor\Extension\Domain\Validator\FooValidator.

If it existed, it had been registered automatically and could not
be disabled at all.

Type validators are similiar to model validators. Given a non
model action parameter or model property like int, string, float,
DateTime and such, extbase searched for validators in the
namespace TYPO3\CMS\Extbase\Validation\Validator.

There is a TYPO3\CMS\Extbase\Validation\Validator\StringValidator
for example which had been registered for string type params and
properties.

Said validators could not be disabled at all.

There are several reasons why the automatic registration has been
removed:

- First of all, this behaviour led to an unknown amount of actual
registered validators. Developers that are new or simply not
familiar with the concept of validation magic could easily
become frustrated.

- Then there is the problem that validation takes place, no matter
if it was needed or wanted. A domain validator, which looked
quite handy in the first place, had to be reduced to the
validation logic that would fit all cases where according
objects had been passed into methods. No matter the context.
The context however matters a lot. One might want to have
different validation rules depending on if objects are
created, updated or deleted. This distinction was impossible
and therefore model validators could be a burden.

- Last but not least, the automatic registration is a problem
when introducing validation groups. Validation groups cover
the context aspect mentioned earlier. By grouping validations
one can create and register different validators and apply
them given by contexts like create, update, delete and such.

Releases: master
Resolves: #87957
Change-Id: If8f590a1bedb428c8884cd61828d8cc671ee92e1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60298
Tested-by: TYPO3com <>
Tested-by: Stefan Froemken <>
Tested-by: Benni Mack <>
Reviewed-by: Stefan Froemken <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Gerrit Code Review 9 months ago

  • Status changed from New to Under Review

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

#2 Updated by Gerrit Code Review 9 months ago

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

#3 Updated by Gerrit Code Review 9 months ago

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

#4 Updated by Gerrit Code Review 7 months ago

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

#5 Updated by Gerrit Code Review 7 months ago

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

#6 Updated by Gerrit Code Review 6 months ago

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/c/Packages/TYPO3.CMS/+/60298

#7 Updated by Gerrit Code Review 6 months 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/c/Packages/TYPO3.CMS/+/60298

#8 Updated by Gerrit Code Review 6 months 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/c/Packages/TYPO3.CMS/+/60298

#9 Updated by Anonymous 6 months ago

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

#10 Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF