[TYPO3-mvc] FAL - create FileReference from within a frontend controller action
Jan Kornblum
jan.kornblum at gmx.de
Fri Oct 31 14:39:42 CET 2014
Hi Helmut,
thanks a lot for your hints!
> $fileReference =
> $this->objectManager->get('TYPO3\\CMS\\Extbase\\Domain\\Model\\FileReference');
>
> and set the original FAL file object you want to reference:
>
> $fileReference->setOriginalResource($falFileReference);
>
> Add $fileReference to your object storage and pass your entity object to the
> repository "update" method so that changes are persisted.
But i still get the same error with "setOriginalResource". Something
else must be wrong with my code:
// Move the file from /tmp/anything
$movedFile = $storage->addFile($filePath, $targetFolder, $fileName);
// Create new file reference
$newFile = $storage->getFile($movedFile->getIdentifier());
$newFileReference =
$this->objectManager->get('Xxx\\Yyy\\Domain\\Model\\FileReference');
$newFileReference->setOriginalResource($newFile);
Have you got any idea?
Kind regards, Jan
More information about the TYPO3-project-typo3v4mvc
mailing list