/** * Finds the SourceMessage model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SourceMessage the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SourceMessage::findOne(['id' => $id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Deletes an existing Message model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @param string $language * @return mixed */ public function actionDelete($id, $language) { $this->findModel($id, $language)->delete(); SourceMessage::findOne($id)->delete(); return $this->redirect(Url::previous()); }