return \Response::forge('whatever-you-want-to-return')->set_header($name, $value);
$response = \Response::forge(); $response->body('whatever-you-want-to-return'); $response->set_header($name, $value); return $response;
$this->response = \Response::forge();in your controller constructor, and return $this->response in your action methods. This way you can still do whatever you want to do now, and still have a working controller when you upgrade to the next FuelPHP version. I've added some clarification to the documentation as to the use of the return value in Controller action methods.
Up until 1.1, you should have used $this->response. Return values were ignored. As of 1.1, you should use a return value (anything that can be cast as string), and $this->response is deprecated. This means you can still use $this->response, so your pre-1.1 code isn't broken, but you'll see a warning in the logs about the fact that you're using deprecated code. If you use both, you're doing it wrong. It's either one or the other. And as of the next version, $this->response will be completely removed. So it should not be used anymore in any bit of code you write now. The reference to $response has already been removed from the development documentation. If you insist on using $this->response in your controllers, use$this->response = \Response::forge();in your controller constructor, and return $this->response in your action methods. This way you can still do whatever you want to do now, and still have a working controller when you upgrade to the next FuelPHP version. I've added some clarification to the documentation as to the use of the return value in Controller action methods.
A controller action should return it's result. The result can be a string, or anything that can be cast to string, like for example a View object. Alternatively you can return a Response object. You use a Response object primarily if you need to set special HTTP headers, or a custom HTTP status code ( a code other than "200 OK" ).
It looks like you're new here. If you want to get involved, click one of these buttons!