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.');