troelskn / konstrukt

A HTTP-friendly framework of controllers for PHP5.
http://konstrukt.dk/
Other
99 stars 14 forks source link

Break the chain - return without earlier wrap*() #14

Closed lsolesen closed 12 years ago

lsolesen commented 13 years ago

Earlier I returned:

return new k_HttpResponse(200, $content);

And that would break the chain and directly output the content from that controller without wrapping the content in the output from the earlier controllers.

Now k_HttpResponse is deprecated, and I just return:

return k_HtmlResponse($content);

However, that does not break the chain. What can I use now?

troelskn commented 13 years ago

Good question. I think you should go on and use k_HttpResponse for this scenario. In general, it's a bad pick, because it doesn't reveal its type, thus making it possible to wrap, but this is exactly what you want to prevent.

tldr - Perhaps it was a bit premature to deprecate k_HttpResponse.

lsolesen commented 13 years ago

If that is the only way to prevent wrapping, the k_HttpResponse should not be deprecated.