Symfony config.yml - How to pass constructor arguments by name? Symfony config.yml - How to pass constructor arguments by name? symfony symfony

Symfony config.yml - How to pass constructor arguments by name?


To be honest I never saw injecting arguments using keys.I know you can use keys when dealing with parameters or when injecting using setters, like the documentation says:http://symfony.com/doc/current/book/service_container.html#optional-dependencies-setter-injection

If you want to inject using setters you could do:

//config.ymlservices:    some.service.name:        class: SomeClass        calls:            - [setFormat, "[%%datetime%%] %%channel%%.%%level_name%%"]

But the Monolog LineFormatter doesn't support that.

In the end I think you will go for the common array mode.

I hope this helps, if you have some docs showing examples using keys I would like to see that and then we can discuss it!