You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
A form type that can add/remove/show one or multiple files
Handling of asynchronous uploads (this is what this bundle does) because input type file feels massively outdated
Attaching files to existing data like doctrine entities
Cleanup after entity deletion
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.
The mapping name
The file identifier
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:
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: