[TYPO3-dev] How to create a FileReference with extbase
Nicolas de Haen
typo3 at ndh-websolutions.de
Mon May 13 12:25:50 CEST 2013
Hi,
I'm currently trying to make proper use of the FAL API in an extbase
model. I want to add an uploaded file to a "Document" model
I can add the uploaded file to the storage via $storage->addUploadedFile
but in the model I need a file reference, since the TCA coming from
ExtensionManagementUtility::getFileFieldTCAConfig() refers to the table
sys_file_reference
The API documentation recommends this:
http://wiki.typo3.org/File_Abstraction_Layer#Add_file_reference
but this uses TCEmain which requires a Backend User...
The extbase model TYPO3\CMS\Extbase\Domain\Model\FileReference does not
provide any TCA or Repository - not even a constructor.
The only workaround I found so far is to store the file identifier as a
string property in my model and implement all FAL stuff in the getFile
method which is probably not "best practice"...
regards,
Nico
--
Nico de Haen
ndh websolutions
Webprogrammierung, OpenSource, Typo3
http://www.ndh-websolutions.de
More information about the TYPO3-dev
mailing list