/**
  * Finds the SBlackWord model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return SBlackWord the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = SBlackWord::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #2
0
 public function validRecord()
 {
     $SBlackWord = SBlackWord::find()->all();
     $session = Yii::$app->session;
     foreach ($SBlackWord as $word) {
         if ($this->searchWord($word->value)) {
             $arr_word[] = $word->value;
         }
     }
     if (isset($arr_word) and count($arr_word) > 0) {
         $msg = "Ошибка в контенте предложения! Присутствуют запрещеные слова: ";
         foreach ($arr_word as $word) {
             $msg .= $word . " ";
         }
         $session->setFlash('error', $msg);
         return false;
     }
     return true;
 }