public function actionEditableCreator() { if (isset($_POST['Category'])) { $model = new Category(); $model->attributes = $_POST['Category']; if ($model->save()) { echo CJSON::encode($model->getAttributes()); } else { $errors = array_map(function ($v) { return join(', ', $v); }, $model->getErrors()); echo CJSON::encode(array('errors' => $errors)); } } else { throw new CHttpException(400, 'Invalid request'); } }