-
Notifications
You must be signed in to change notification settings - Fork 1
Consider wiring lazy-loading directly in the container of L5? #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I guess I could try to suggest this as a PR to |
Well, consider that in symfony, you just need to mark a service as In zf2 it got a bit more flexible, so you can do more things, but you'd register a custom "lazy" factory and have ProxyManager autoloaded (no need to swap out containers). So yeah... laravel is pretty much the same. Actually, if |
I'll check the In ZF2, is the implementation baked on the container, or is it a package? |
|
I want this to be more pluggable, but Laravel's current architecture doesn't let you plug a different So I'm left with a Decorator, a Bridge or extending. L5 provides a contract for both classes so I could do a Bridge, but extending looks so simple... |
Yeah, but it won't be adopted either, heh |
@Ocramius so... I had a small chat with Taylor on friday. He sees proxying out services from the Container as "Bad design", and when I tried to talk to him about decoupling the container and making it more extensible, he just disregarded me. In his mind, Container shouldn't be extensible and if a case arises, we should consult him directly. Nothing surprising really, but very frustrating anyway. |
@guiwoda I also believe that extending the container is not a good idea. Consider looking at following PRs for inspiration: Both those exponentially improve the containers, but they are not there as an extensibility mechanism. |
The difference is that both sf and zf2 frameworks use Containers, while Laravel is a (extends the) Container. In any case, if Container doesn't have an extensibility mechanism, and Taylor doesn't agree with lazy instantiation, then it's a no-go for this. |
😞 |
@guiwoda Does this package work? I'm very interested in lazy-loaded services. |
@vladyslavstartsev the problem is inheriting from the framework DIC, like this package does. |
As it stands, this is a standalone container. I suggest trying to bake this functionality into L5 without introducing a strict dependency to the ProxyManager or this lib.
The text was updated successfully, but these errors were encountered: