/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { try { $model = new ProTestimonial('create'); if (isset($_POST['ProTestimonial'])) { $model->attributes = $_POST['ProTestimonial']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model, 'actions' => $this->listActionsCanAccess)); } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }
if ($model = $this->loadModelVendorPurchaserDetail($id)) { // $model->need_delete = 1; // $model->update(array('need_delete')); if ($model->delete()) { Yii::log("Delete record " . print_r($model->attributes, true), 'info'); } } } else { Yii::log("Invalid request. Please do not repeat this request again."); throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } } /** * @Author: ANH DUNG Mar 28, 2014 * @Todo: load model ProTransactionsVendorPurchaserDetail * @Param: $id is pk * @Return: model */ public function loadModelVendorPurchaserDetail($id, $modelName = 'ProTransactionsVendorPurchaserDetail') { try { $model_ = call_user_func(array($modelName, 'model')); $model = $model_->findByPk($id); if ($model === null) { Yii::log("The requested page does not exist."); throw new CHttpException(404, 'The requested page does not exist.');