Reputation: 1268
I've read some post regarding this subject but I'm still wondering if there is a better way to "auto inject" any service. I mean, if I have a namespace called person services (which includes personalDataService, relativesDataService, etc) it'd be great if I could do something like this:
services:
Person.personalData:
class: Main\UserBundle\Services\PersonalDataService
arguments: [Person.*]
Person.relativesData:
class: Main\UserBundle\Services\RelativesataService
arguments: [Person.*]
I know that is possible to follow this post but I'm looking for other "efficient" way
Upvotes: 3
Views: 140
Reputation: 1654
There is not better way. The best way is the way that is described in your own post...
You don't want to inject unneeded services because if you start injecting services that you won't use then your destroying your own app with clutter and it will more or less slow down. So basicly using the way as described in the post above is the best way because you will be wondering for yourself again what do I really need and only put in the neccesary stuff... If that means later on you have to change your config and service constructor because you need an extra service injected so it is.
I hope this answers your question...
Upvotes: 1