Hello there,
I recently noticed a that Phalcon\Mvc\Controller contains a field $response, should I guess this question is kind of self answering, but is it good practice to use this $response field or should I instantiate a new Phalcon\Http\Response by myself?
EG:
class FooController extends Controller{
function testAction(){
$response = new Phalcon\Http\Response();
//Do Some Stuff
$response->setContent($content);
$response->setStatusCode(200, 'Ok');
return $response;
}
}
or
class FooController extends Controller{
function testAction(){
//Do Some Stuff
$this->response->setContent($content);
$this->response->setStatusCode(200, 'Ok');
return $this->response;
}
}