[TYPO3-mvc] FAL - create FileReference from within a frontend controller action

Jan Kornblum jan.kornblum at gmx.de
Fri Oct 31 16:05:20 CET 2014


> 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);

Hmm, what i don't understand: I want to create a FilereReference 
object, but after the empty object has been created i should use an 
additional method (setOriginalResource) which itself expects such an 
(not yet existing) object as given parameter. How should this work?

Might "createFileReferenceFromFalFileObject" from your example be the 
right direction?

Sometimes Extbase is really hard, i've already spent so many hours with 
this problem :(

Kind regards, Jan




More information about the TYPO3-project-typo3v4mvc mailing list