Bug #91678
openDefault validation of domain objects passed to extbase action causes massive performance load
0%
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...
Updated by Susanne Moog over 2 years ago
- Complexity changed from no-brainer to medium