Beispiel #1
0
 /**
  * Shortcut for rendering a JSON response
  * @param array $data: the PHP array that will be put into the JSON data index
  * @param string $errorMsg: If you want to return an error message, pass one
  * @param string $file: the file where the error message happened
  * @return a JSONResponse
  */
 protected function renderJSON($data = array(), $errorMsg = null, $file = '')
 {
     $response = new JSONResponse($this->appName);
     $response->setParams($data);
     if ($errorMsg !== null) {
         $response->setErrorMessage($errorMsg, $file);
     }
     return $response;
 }