I am quite confused with how action methods in controllers work on Phalcon 2 when you specify a return. I am building an API and I'm finding it weird that adding return false after $this->response->setJsonContent(...) in a method, the JSON content is printed but if I use return or return true it is not.
Why does it do that?
public function indexAction()
{
$this->response->setJsonContent(['test' => 1]);
return false;
}
Without the return false, it prints nothing. With the return false and send() it prints the JSON twice.
Is there a way to print the JSON content automatically without send() but not print it with return false?