-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doctrine/form Integration bundle #378
Labels
Comments
Hey Marco Thank you for your contribution! We'll keep an eye on this and as soon as we had time to look closer, we can discuss our points further over here. Feel free to add more comments or adapt parts if you need. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was (or actually still am) searching for a nice uploading process within a symfony project. I tried this bundle and thought the implementations are awesome, especially the orphanage. But I miss a lot of other aspects which is fine, this bundle does 1 thing really well instead of all the things only partially.
I see 4 areas necessary for a seamless file handling in a symfony multipage application:
This bundle is really good at 2. but does not touch 1, 3 or 4, that's all left to the individual project.
the VichUploader Bundle handles 3 and 4 but both not really elegant as it is really verbose in entity handling and cleanup only works when entities are deleted directly. There is no check to delete files of which the entity is removed. The Vich uploader bundle also relies on the symfony FileType for uploads which isn't great.
what am I suggesting?
I would like to have a doctrine and a form integration based around this uploader bundle.
doctrine integration
My idea is to create a FileReference doctrine entity that simply has 2 fields.
When the entity is persisted/flushed, then the file must be moved from the orphanage to the actual storage. When the entity is deleted, the file must be deleted as well. There also needs to be a cleanup process to delete files that are no longer referenced.
Building a model like this allows to add one or many file references to any entity simply by using a relation. No magic mapping required.
form integration
Now this is heavily related to the doctrine integration. Simply plopping something like a DropzoneType into any form that uploads one or multiple files to the orphanage and adds FileReference's into a Model would be awesome.
The html part woud just add the identifiers into the form and a data mapper would map those to the correct uploader mapping. The doctrine bundle would move the files into the real storage.
By heavily using mapping of this uploader bundle, this could be entirely storage agnostic.
why am I bringing this up?
What I describe here is a lot of work and those are just ideas i had while researching. So I thought I share those ideas here to discuss. Who knows, maybe everything i described is already possible with other bundles I just haven't found.
Maybe we can even collaborate here.
The text was updated successfully, but these errors were encountered: