/** * @brief sets a global system value * @param array $urlParams: an array with the values, which were matched in * the routes file */ public function setSystemValue($urlParams = array()) { $value = $this->params('somesetting'); $this->api->setSystemValue('somesetting', $value); $response = new JSONResponse($this->appName); $params = array('somesetting' => $value); $response->setParams($params); return $response; }
/** * 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; }