northwoods / container

Container wrapper for Auryn dependency injector
MIT License
9 stars 3 forks source link

Implement 'shared' and 'shared_by_default' configs #5

Closed guilhermeaiolfi closed 7 years ago

guilhermeaiolfi commented 7 years ago

The reasoning and more details about it can be found here:

https://discourse.zendframework.com/t/shared-instances-and-containerinterface/200/10

shadowhand commented 7 years ago

Fixed in version 1.2.0. I will update zendframework/zend-expressive-skeleton#161 shortly.

guilhermeaiolfi commented 7 years ago

I don't think it covers cases where classes weren't specify anywhere in the configs but get(MyClass) should return a shareable instance.

shadowhand commented 7 years ago

@guilhermeaiolfi I don't think it should. The goal is compatibility with service manager not to modify how Auryn works... 🤔

guilhermeaiolfi commented 7 years ago

Can you confirm that's not how Zend manager works? I've never use it and I can't verify it right now.But 'shared_by_default' seems pretty wide for me. And it would be more aligned to the PSR description of the get method.

Isn't that interop we are looking for? I don't see the advantage of being able to change implementations if I'll have to deal with inconsistencies between them.

The 'should' word in the PSR is a strong recommendation.

Em 22 de jul de 2017 12:44 AM, "Woody Gilk" notifications@github.com escreveu:

@guilhermeaiolfi https://github.com/guilhermeaiolfi I don't think it should. The goal is compatibility with service manager not to modify how Auryn works... 🤔

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/northwoods/container/issues/5#issuecomment-317151505, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPhmCB06xfkxC-xNceNlGy8Ta8kfu8Hks5sQXAxgaJpZM4OcoB7 .

shadowhand commented 7 years ago

AFAIK, Zend manager requires that every class have some kind of a definition. Auryn doesn't.

shadowhand commented 7 years ago

For whatever it's worth, my goal with this package is to provide the thinnest layer possible to allow Auryn to be used as a container implementation. The whole service manager bit is, IMO, a pretty crappy way to do dependency injection. The only reason I implemented it was to get Zend Expressive working.