-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Autoloading Aliases #3940
Autoloading Aliases #3940
Conversation
Okay got the branch issue cleared up, ready for re-review! |
I understand why you want to do this, especially with the PSR7 stuff coming up. I guess I'm a little concerned this muddies up when to use this vs using a service. This also wouldn't make services nearly as explicit since you may call one class in the service, but it gets implicitly aliased in a config file. To me this adds a bit of confusion to the framework. I'm curious to hear other's thoughts. |
I would like to hear others' thoughts as well. I wouldn't consider this ideal but it provides two things that we don't have currently:
Services can kind of solve the first problem but then you're stuck with the new version in App, which works if you've transitioned to a new namespace but not really if you've tried to do an in-place swap. |
Two alternatives that I see:
|
My thoughts on this:
--or--
|
One more thing to think about: currently there is no way to replace system-defined services. I assume this is a mistake/bug, but it adds another layer of difficulty solved by aliasing. |
I second that aliasing would add a layer of confusion. Personally I use Services all over the place and love the simplicity. Regarding overriding framework classes, in my 4.0.4 project I have "fixed" the Redis TTL bug by creating my own RedisHandler and adding my own class to |
Thanks all for the feedback. It sounds like we want to stick with our current tools, and avoid adding layers of complexity that something like this aliasing introduces. Closing. |
Description
This PR adds a new
Autoloader
property to the config file:$aliases
. Aliasing will allow the autoloader to intercept a class request and return an aliased version instead on-the-fly. This will make it easier to transition framework classes with user intervention as well as to replace core classes with user-defined versions.Checklist: