auraphp / Aura.Di

Dependency Injection System
MIT License
349 stars 63 forks source link

Add ResolutionHelper #143

Closed jakejohns closed 7 years ago

jakejohns commented 7 years ago

RE: #133 ...Thoughts?

pmjones commented 7 years ago

Nice. Do we want to allow for resolving services from strings? E.g., $resolver('foo') might ought to look into the DI container for a service matching 'foo', then fall back to a new instance of class foo. (That would mean injecting the container into the resolver, which seems reasonable.)

jakejohns commented 7 years ago

More like this?

Additionally...

Options on the services stuff?

Should this checking services first stuff be optional or configurable at all? or is that just over complicating things. eg a checkServices($bool) method, or a flag on the constructor that if true, checks services and if false just give new instance? Maybe not needed.

How to get it?

Should there be a getResolutionHelper method on Containerala the getInjectionFactory? Or just let people set it up themselves? If there's a method, should it return a new one each time, or treat it like a service?

pmjones commented 7 years ago

Should this checking services first stuff be optional or configurable at all?

Hm. I say "not for now."

Should there be a getResolutionHelper method on Containerala the getInjectionFactory?

Yes. Return a new one each time.

jakejohns commented 7 years ago

Any bright ideas on where/how to include in the docs?

pmjones commented 7 years ago

Any bright ideas on where/how to include in the docs?

In a separate PR. :-)