SonataMediaBundle: change default filesystem s3 adapter

43 Views Asked by At

Is it possible to use a different class for sonata.media.adapter.filesystem.s3 service? Right now I can see it's hardcoded in gaufrette.php:

->set('sonata.media.adapter.filesystem.s3', AwsS3::class)
    ->args(['', '', ''])

Is it possible to override this behaviour and set any other adapter class, e.g. Gaufrette\Adapter\AsyncAwsS3?

1

There are 1 best solutions below

4
Blackbam On

According to Symfonys architecture it should be possible to override pretty much everything: https://symfony.com/doc/current/bundles/override.html#services-configuration

If you want to modify the services created by a bundle, you can use service decoration. If you want to do more advanced manipulations, like removing services created by other bundles, you must work with service definitions inside a compiler pass.

Most probably you solution is the latter. Here is an existing question on how to do that: Symfony: Overriding Symfony service ( compiler pass )