Closed harikt closed 8 years ago
I don't know if this is the right solution. It looks like it will swallow all exceptions during auto-resolution, which is not ideal.
I think that it should only handle cases where the class is not instantiable. After that, any dependency resolution should throw exceptions as usual.
I believe that this is how PHP-DI handles it (see here).
My current thinking is:
has
should return true if the service is defined OR (auto-resolution is enabled AND the class is instantiable).get
should look for a defined service first, otherwise it should use newInstance
to create the service if auto-resolution is enabled.This would solve #112 as well.
Edit: See also https://github.com/container-interop/container-interop/pull/65#issuecomment-185217599
@harikt Given other conversations on this subject, I'm closing this PR as "not needed just yet". We can reopen it if Glen decides it's really necessary after all.
sure :) .
If autowiring is enabled try to register the service when it is not available in current container or in delegate container.