There is an example in the official documentation about how to write custom provider, but it doesn't work.
My question is: what is the best way to write custom provider, especially how to write and register provider as a new service?
When I try to use this code from documentation, I get errors about type of arguments. What does mean empty argument?
Thank you.
I couldn’t get this to work until i named the service exactly as the one i was overriding (sonata.media.provider.image)
See https://stackoverflow.com/a/20118256/4239642
After some investigation, the following code works:
Register provider as a service:
Custom Provider code:
Updated sonata configuration:
And I've also setup DI extension to autoload
services.yml
I made a PR to update outdated documentation.