Hello all,
very simple scenario: the frontend user can upload his image himself.
My previous implementation only worked because I added the property “picture” to the model “FrontendUser”, which is of type “FileReference”.
BUT the FrontendUser already has a picture: The property “image”. But this is (for whatever reason) of type “ObjectStorage<FileReference>
” with a maximum number of 1.
:?
Now to my question: In the docu there is a reference to an example - does it all have to be so complicated?
What you need everything apparently:
- an own version of the model "FileReference
- an own ObjectStorage-Converter
- an own FileReference converter
- and an own Update-View-Helper
In the sample controller I also find the lines:
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(Container::class)
->registerImplementation(
\TYPO3\CMS\Extbase\Domain\Model\FileReference::class,
\Helhum\UploadExample\Domain\Model\FileReference::class
);
where the “container” class is marked as deprecated. :?
I can’t figure out from the deprecated annotation either, unfortunately:
“Use symfony DI and GeneralUtility::makeInstance() instead.
”
What is symfony DI ?
And does this DI then also provide “registerImplementation()
” ? Is this some kind of class replacement ? And is that a good example then ?
Is uploading files so unusual that it doesn’t need more attention or does it have to be so individual every time?
All my questions are quite serious and polite. If they come across as “trollish”: I didn’t mean there… I would rather like to understand the background better.
Greetings
Clemens
PS: I am already looking forward to the LTS 12 version. There is apparently a TCA directory selector… so you can, then specify the destination of the upload files better.
Translated with www.DeepL.com/Translator (free version)
Hallo zusammen,
ganz einfaches Szenario: Der Frontend-Nutzer kann sein Bild selber hochladen.
Meine bisherige Implementierung hat nur funktioniert, weil ich das Model “FrontendUser” um die Eigenschaft “picture” ergänzt hatte, welches vom Typ “FileReference” ist.
ABER der FrontendUser hat ja bereits ein Bild: Die Eigenschaft “image”. Diese ist aber (warum auch immer) vom Typ “ObjectStorage” mit einer maximalen Anzahl von 1.
:?
Nun zu meiner Frage: In der Doku wird auf ein Beispiel verwiesen - muss das alles so kompliziert sein?
Was man alles scheinbar braucht:
- eine eigene Version des Model “FileReference”
- einen eigenen ObjectStorage-Converter
- einen eigenen FileReference-Converter
- und einen eigenen Update-View-Helper
Im Beispiel-Controller finde ich auch die Zeilen:
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(Container::class)
->registerImplementation(
\TYPO3\CMS\Extbase\Domain\Model\FileReference::class,
\Helhum\UploadExample\Domain\Model\FileReference::class
);
wobei die Klasse “Container” als deprecated markiert ist. :?
Aus der deprecated-Anmerkung werde ich leider auch nicht schlau:
“Use symfony DI and GeneralUtility::makeInstance() instead.”
Was ist symfony DI ?
Und bietet dieses DI dann auch “registerImplementation” ? Ist das so eine Art Klassen Replacement? Und ist dass dann ein gutes Beispiel?
Ist das Hochladen von Dateien so ungewöhnlich, dass es keiner größeren Aufmerksamkeit bedarf oder muss das jedes mal so individuell sein?
All meine Fragen sind ganz ernst und höflich gemeint. Wenn diese “Trollig” rüberkommen: Da wollte ich nicht… ich möchte eher den Hintergrund besser verstehen.
Grüße
Clemens
PS: ich freue mich ja schon auf die LTS 12er Version. Da gibt es scheinbar einen TCA-Verzeichnis-Selektor… damit kann man, dann des Zielort der Upload-Files besser spezifizieren.