Skip to content
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

Can i somehow extend GaufretteStorage and inject my storage to plugin #326

Closed
n1ks2n opened this issue Mar 15, 2018 · 5 comments
Closed
Labels

Comments

@n1ks2n
Copy link

n1ks2n commented Mar 15, 2018

I need to extend some functionality on top of GaufretteStorage, for example generating url to file by it's name on server. It makes sense to add this to Storage cause Storage has access to actual config and should know where the application stores files. So my question is that why Storages aren't configures like services cause there is no possibilities to inject overriden service and also to use this service in some custom helpers. And if i miss something and there is the way to do it please give me an example.

@bytehead
Copy link
Member

Hi there!
I'm not sure, if I understand you correctly. The storages are actually registered as services:

protected function createStorageService(&$config, $key, $orphanage = false)

Why don't you extend GaufretteStorage and replace this?

<parameter key="oneup_uploader.storage.gaufrette.class">Oneup\UploaderBundle\Uploader\Storage\GaufretteStorage</parameter>

@n1ks2n
Copy link
Author

n1ks2n commented Mar 19, 2018

Trying to extend the service and replace parameter using compilerPass makes no effect. And also service should be registered as a service not a param, to be able to override it in compiler pass.

@bytehead
Copy link
Member

I see. Seems to be a wrong decision back in the days. Did you check any possibilities when using Flysystem as storage layer?

@n1ks2n
Copy link
Author

n1ks2n commented Mar 19, 2018

This is the same as Gaufrette storage layer. I mean the difference between those two abstractions is only under the hood. And as u can check in bundle config - Flysystem is also set up as parameter. And tbh Gaufrette is used be default in my project and there is no way to change it now. But i've managed to do what i've needed in different way just using base Gaufrette Bundle functionality. So u can close this question now, just wanted maintainers to know that there are some lacks in architecture that prevent this bundle to be extended and easier implemented to projects =))

@bytehead
Copy link
Member

I totally understand your point of view. We are aware of this lacks (same here #317), we just don't have time to improve this atm 🙂
Thanks anyway for mention it, we take care of this in the next major!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants