Issue Bug Closed

#99342Field `originalResource` is null in the object fileReference of an objectstorage of an custom model, which ist parameter in an extbase-controller

Dieter Porth 12/12/22, 07:52 updated 06/24/23, 12:35

Description

My controller will reciece an object TaskAssignement . The object contains in the field files a storageObject, which contains a list of filereferences.
The field originalResource is null.

I would expect, that the field originalResource ist filled with the object TYPO3\CMS\Core\Resource\FileReference and in related object.

To fix this bug, I had to use the folowing method in my controller.
```

/**
 * param TaskAssignment $taskAssignment
 *
 * return void
*/
protected function bugFixTYPO3ForMissingObjectsInFileRepresentation(TaskAssignment $taskAssignment): void
{
/** var ObjectStorage $listFilesStorage */
$listFilesStorage = $taskAssignment->getFiles();
if ($listFilesStorage !== null) {
$listFilesStorage = $listFilesStorage->toArray();
/**
var FileReference $fileRef */
foreach ($listFilesStorage as $fileRef) {
$fileRef->setOriginalResource($fileRef->getOriginalResource());
$fileRef->getOriginalResource()->getProperties(); // result is not used. only the build of merged properties are triggerd
}
}
}

```

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.