public function actionEditableCreator() { if (isset($_POST['Actor'])) { $model = new Actor(); $model->attributes = $_POST['Actor']; 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'); } }