|
@@ -14,14 +14,14 @@ class BenchController extends \Phalcon\Mvc\Controller
|
|
|
|
|
|
public function jsonAction()
|
|
public function jsonAction()
|
|
{
|
|
{
|
|
- return $this->sendContentAsJson(array(
|
|
|
|
|
|
+ return $this->response->setJsonContent(array(
|
|
'message' => 'Hello, World!'
|
|
'message' => 'Hello, World!'
|
|
));
|
|
));
|
|
}
|
|
}
|
|
|
|
|
|
public function dbAction()
|
|
public function dbAction()
|
|
{
|
|
{
|
|
- return $this->sendContentAsJson($this->getRandomWorld());
|
|
|
|
|
|
+ return $this->response->setJsonContent($this->getRandomWorld());
|
|
}
|
|
}
|
|
|
|
|
|
public function queriesAction()
|
|
public function queriesAction()
|
|
@@ -35,7 +35,7 @@ class BenchController extends \Phalcon\Mvc\Controller
|
|
$worlds[] = $this->getRandomWorld();
|
|
$worlds[] = $this->getRandomWorld();
|
|
}
|
|
}
|
|
|
|
|
|
- return $this->sendContentAsJson($worlds);
|
|
|
|
|
|
+ return $this->response->setJsonContent($worlds);
|
|
}
|
|
}
|
|
|
|
|
|
public function fortunesAction()
|
|
public function fortunesAction()
|
|
@@ -64,7 +64,7 @@ class BenchController extends \Phalcon\Mvc\Controller
|
|
$worlds[] = $world;
|
|
$worlds[] = $world;
|
|
}
|
|
}
|
|
|
|
|
|
- return $this->sendContentAsJson($worlds);
|
|
|
|
|
|
+ return $this->response->setJsonContent($worlds);
|
|
}
|
|
}
|
|
|
|
|
|
public function plaintextAction()
|
|
public function plaintextAction()
|
|
@@ -72,7 +72,7 @@ class BenchController extends \Phalcon\Mvc\Controller
|
|
$this->view->disable();
|
|
$this->view->disable();
|
|
$this->response->setContentType('text/plain');
|
|
$this->response->setContentType('text/plain');
|
|
$this->response->setContent("Hello, World!");
|
|
$this->response->setContent("Hello, World!");
|
|
- $this->response->send();
|
|
|
|
|
|
+ return $this->response;
|
|
}
|
|
}
|
|
|
|
|
|
protected function getRandomWorld()
|
|
protected function getRandomWorld()
|
|
@@ -103,11 +103,4 @@ class BenchController extends \Phalcon\Mvc\Controller
|
|
});
|
|
});
|
|
return $fortunes;
|
|
return $fortunes;
|
|
}
|
|
}
|
|
-
|
|
|
|
- private function sendContentAsJson($content)
|
|
|
|
- {
|
|
|
|
- $response = new Phalcon\Http\Response(json_encode($content));
|
|
|
|
- $response->setHeader("Content-Type", "application/json");
|
|
|
|
- return $response;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|