You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lot of support code (e.g. the error display handler) winds up hooking into Controller::has_curr() and Controller::curr(). This is awkward coupling, and it will make it harder to use SilverStripe code with other controller implementations.
Initially, I've posted this issue as an anchor point so that I can refer to it in TODO comments in code.
The text was updated successfully, but these errors were encountered:
A lot of the time this is necessary because the current request is only available from the current controller. Maybe we should have SS_HTTPRequest::curr() instead?
My reason for raising this was to suggest to that we reduce the amount of static coupling. SS_HTTPRequest::curr() would be of limited value.
sminnee
changed the title
Reduce coupling to Controller::has_curr() and Controller::curr()
Reduce static coupling to Controller::has_curr() and Controller::curr()
Aug 5, 2015
For example, we might want to inject something into HTTPOutputHandler that can receive the responses, I guess that it might be better to have some kind of output destination for errors? If nothing else, it would make it easier to test.
Assuming that we move towards PSR-7, which uses immuatable response object, then the injected property might be a writer with an interface like this
interface HttpWriter {
function write(Psr\Http\Message\ResponseInterface $response);
}
HTTPOutputHandler can then output like this, rather than calling response->output(), and probably don't need to get the Controller response at all...
A lot of support code (e.g. the error display handler) winds up hooking into
Controller::has_curr()
andController::curr()
. This is awkward coupling, and it will make it harder to use SilverStripe code with other controller implementations.Initially, I've posted this issue as an anchor point so that I can refer to it in TODO comments in code.
The text was updated successfully, but these errors were encountered: