Project

General

Profile

Actions

Bug #91678

open

Default validation of domain objects passed to extbase action causes massive performance load

Added by This Mächler almost 4 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-06-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.2
Tags:
extbase action parameter validation
Complexity:
medium
Is Regression:
Sprint Focus:
Remote Sprint

Description

I experienced that a domain-object passed as a parameter to an action of an actionController in extbase receives the following treatment:

- all getters of the domain object are called
- all gettter of all sub-domain objects are called (even if lazy-loading is annoted in the model)
- all getters of all sub-sub-domain objects are called

WTF? Are you serious? This is the standard validation! If you not know as a developer, and you maybe do some stuff in your getter-functions (like overcome the flaws of the bad workspace implementation), and your model is a bit nested, you will eventually end up in thousands of function calls, and eventually thousands of queries (if you do queries in a getter for some reason).

In my views this has to be changed in a more lightweight standard validation procedure, or documented very prominently

There is a simple solution indeed, you can simply deactivate the validation of the action arguments, or replace by a different validation:

/**
 * action werkdoks
 *
 * @param \SGPA\Sgpawerke\Domain\Model\WerkCategory $werkCategory
 * @param \SGPA\Sgpawerke\Domain\Model\Werk $werk
 * @TYPO3\CMS\Extbase\Annotation\IgnoreValidation("werkCategory")
 * @TYPO3\CMS\Extbase\Annotation\IgnoreValidation("werk")
 * @return void
 */
public function werkdoksAction(
  \SGPA\Sgpawerke\Domain\Model\WerkCategory $werkCategory = NULL,
  \SGPA\Sgpawerke\Domain\Model\Werk $werk = NULL
)    {
...
...
}

In my example here, $werkCategory has 4-30 sub-items (werke), those have 1-10 sub-items (images). Imagine what happens with the standard" validation: a cascade of getterCalls... this can't be really your intension...

Actions #1

Updated by Mathias Schreiber about 2 years ago

  • Sprint Focus set to Remote Sprint
Actions #2

Updated by Susanne Moog almost 2 years ago

  • Complexity changed from no-brainer to medium
Actions

Also available in: Atom PDF