[TYPO3-dev] FAL in an Extbase 6.0 extension... but how?!
Anders Gissel
invadercyg at gmail.com
Thu Jan 31 10:23:04 CET 2013
Hey guys,
I have been trying to figure out how to integrate the fancy new File
Abstraction Layer in a new Extbase-extension I'm working on, since I
want the extension itself to be as modern as possible, and since
t3lib_basicFileFunctions is marked as deprecated, I seem to have little
choice but to either backport the file functions I need myself into a
utility in my extension, and stick with the good old
/uploads/tx_whatever/ format, or to make the switch to FAL. And
obviously the latter would be preferable and vaguely more future proof.
However, what little documentation exists on FAL is sorely lacking, at
best. There seem to be no coding examples, outside of the basic "this is
how you display all files in a filemount"-example found in the original
FAL-presentation slides, and they don't cover the integration of FAL in
a domain model object at all.
So. Basically, I have a model object that needs a single reference to a
file (an image, if you must know). I spent hours trying every
permutation of \TYPO3\CMS\Core\Resource\* for my file object I could
think of, but at best I got nothing, at worst I got exceptions from the
SQL-layer. And while I got the TCA to sort-of work (I got it to present
me with a buggy imitation of the file selector so prominently on display
in the tt_content editor), I couldn't for the life of me get the stored
data out of the model object in the frontend. Again, exceptions all
around, with little indication of what actually went wrong.
So I'm pleading with you – because surely someone smarter than I (that's
practically most of the planet) must have made an extension with a
working FAL-integration, right? Can anyone point me to a project on TER
or GitHub that I can dissect and learn how to go about this? Or, if such
a project is in the works but hasn't been released yet, help me the hard
way by answering these questions:
1) How on earth does one define a field in the domain model, so that it
accepts, stores and returns a proper file reference?
2) How should the TCA for such a field be defined, so that it can be
safely used in the backend? The extension builder's solution results
in... well, nothing.
3) Bonus question: how does one go about storing a new file in a FAL
storage through the frontend? Let's assume I have all the file data
readily at hand, and I just want to store it in a pre-defined file
storage. But how?
Once I've figured these things out, I'll happily write proper code
examples and publish them online – if nothing else on my own website,
but I'll be happy to add it to an official Wiki or... whatever. Google
is of no help; I'm probably not the first to run into this problem, and
I certainly won't be the last.
Here's hoping. Because surely it's just the documentation that's lacking
and me being stupid, and not, as some evil tongues will have me believe,
that the TCA is currently not able to handle FAL references inside an
extension? Right?
Best regards,
Anders Gissel
Denmarkistan
More information about the TYPO3-dev
mailing list