#111644Extbase validation fails for models with file references
Description
Since #110702, validating an Extbase model that has a property typed \TYPO3\CMS\Extbase\Domain\Model\FileReference (e.g. a model using #[FileUpload]) fails with:
#1546632293 RuntimeException Could not get value of property "TYPO3\CMS\Core\Resource\ResourceStorage::fileProcessingService", make sure the property is either public or has a getter getFileProcessingService(), a hasser hasFileProcessingService() or an isser isFileProcessingService().
Steps to reproduce
- Create an Extbase model with a property
protected ?FileReference $file(ExtbaseFileReference) - Submit a form for this model to an action that takes the model as argument, so it gets validated
Cause
ValidatorResolver::buildBaseValidatorConjunction() builds validators for every object-typed property. For the Extbase FileReference model it descends into $originalResource and further into the core FAL objects:
Extbase FileReference
-> core FileReference
-> File
-> ResourceStorage
-> FileProcessingService
-> ProcessedResourceCache
ProcessedResourceCache (added with #110702) has a private property annotated var \WeakMap<systemresourceinterface string>|null@. Extbase treats it as a typed collection and attaches a <code>CollectionValidator</code> to it. The property has no getter, so validation throws.</systemresourceinterface>
Before #110702 this chain happened to produce no validators, so the issue went unnoticed. Extbase should not validate the internals of core FAL objects at all.
Solution
ValidatorResolver must not build nested validators for properties typed as a core resource object (ResourceInterface: File, FileReference, Folder, ProcessedFile, …). Validators added explicitly via #[Validate] on such a property still apply.
Reviews 1
History 01
-
Gerrit Code Review pushed patch set 1 for main to change 98111 status
NewUnder Review 11/27/26, 17:48