Alain
Alain

Reputation: 36954

Inject several parameters from parameters.ini to a service

I am looking for a BEAUTIFUL way to send several parameters from parameters.ini to a service.

Actually to send 10 parameters to my service, I need 10 arguments in my constructor and that's not very beautiful. My code really starts at line 350 (with all attributes and docs) and I'm unsatisfied with that.

According to this answer, I can inject the @kernel service but that's quite a bad practice.

Do you have some advices about that?

Upvotes: 0

Views: 143

Answers (1)

Marino Di Clemente
Marino Di Clemente

Reputation: 3190

you can pass a single argument as associative array of more services and parameters.

Upvotes: 1

Related Questions