コード例 #1
0
ファイル: controller.php プロジェクト: hjimmy/owncloud
 /**
  * Shortcut for rendering a JSON response with just the data
  * @param object $data the PHP object that will be converted to JSON
  * empty array by default
  * @return \OCA\Music\AppFramework\Http\JSONResponse containing the values
  */
 public function renderPlainJSON($data = array())
 {
     $response = new JSONResponse();
     $response->setData($data);
     return $response;
 }
コード例 #2
0
ファイル: controller.php プロジェクト: hjimmy/owncloud
 /**
  * Shortcut for rendering a JSON response
  * @deprecated use return new JSONResponse($data, $statusCode) instead
  * @param array $data the PHP array that will be put into the JSON data index
  * empty by default
  * @param string $errorMsg If you want to return an error message, pass one
  * @return \OCA\Music\AppFramework\Http\JSONResponse containing the values
  */
 public function renderJSON(array $data = array(), $errorMsg = null)
 {
     $response = new JSONResponse();
     $response->setParams($data);
     if ($errorMsg !== null) {
         $response->setErrorMessage($errorMsg);
     }
     return $response;
 }