public function actionSalvarTipoanimal() { $parametros = Util::getParametrosJSON(); $tipoanimal = new Tipoanimal(); $tipoanimal->nome = $parametros['nome']; $response = array(); try { if ($tipoanimal->save()) { $response['sucesso'] = true; } else { $response['sucesso'] = false; } } catch (Exception $e) { throw new CHttpException(404, $e->getMessage() . '[' . Yii::app()->user->petatual . ']'); } Util::setParametrosJSON($response); }