Closed (won't fix)
Project:
Drupal core
Version:
8.0.x-dev
Component:
wscci
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2011 at 09:31 UTC
Updated:
29 Jul 2014 at 20:11 UTC
Having this gigantic switch looks not-nice to me. Can't we do something else? Values / handlers at specific keys?
Comments
Comment #1
aspilicious commentedWell for each "case" you would need a new handler. That means going from 1 handler to 17 or more.
Comment #2
aspilicious commentedOk chx an I talked on irc, he didn't knew how the context caching worked. So I explained him that after the first handler call the value gets saved/cached.
He told me I could close this as "works as designed now :)"
Comment #3
chx commentedThere actually are more questions, mostly as a parting shot as I am leaving -- if such a switch is ok then why do we have path:raw and path:system handlers instead of path? Especially that path:system call path:raw anyways.
And, if all we had were handlers on the top then we could perhaps significantly simplify findValue. And, who knows, make a different API , like $context->http('query:foo') and $context->path('raw')... perhaps.
Comment #4
Crell commentedOriginally we had to fold all of the http handlers into a single object to share the request object without duplicating it. There was no way around that. After we switched to the closure-based registration, it is now possible to split the handler up if we wanted to since we can pass the same request object into all of them. Whether or not that's a good trade off (fewer switches vs. more objects) I don't know.
As designed in the current API, however, HOW the handlers are broken up is independent of the API to reach them. So we can refactor HandlerHttp and the path handlers even after code freeze if it made sense to do so.
Comment #5
Crell commentedDeprecated by the new Symfony-based approach.