snapshotpl / lazy-container

Lazy loading for PSR-11 container
GNU General Public License v3.0
15 stars 1 forks source link

Support lazy-loading of internal dependencies #3

Open Ocramius opened 8 years ago

Ocramius commented 8 years ago

This might be a really hard one to solve, but the idea is simple: lazy services are not necessarily the front-facing services inside your app.

Let's say you have a class:

class MyService
{
    public function __construct(SomethingSlow $iWantThisToBeLazy) {}
}

This kind of container currently only allows MyService to be fetched lazily, but doesn't allow the internal dependency to SomethingSlow to be replaced with a lazy instance.

This problem may not be solvable by the lib as-is, but it is a good scope for research, and it may spawn into further development of the container-interop standard.

snapshotpl commented 8 years ago

👍 I will write test for that