/** * Finds the EmpDocs model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return EmpDocs the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = EmpDocs::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionDeleteDoc($emp_doc_id) { $emp_docs = EmpDocs::findOne($emp_doc_id); if ($emp_docs !== NULL) { $emp_docs->delete(); } else { throw new NotFoundHttpException('The requested page does not exist.'); } return $this->redirect(['view', 'id' => $emp_docs->emp_docs_emp_master_id, '#' => 'documents']); }