/** * Finds the Video Action model based on its primary key value. * If the model is not found, will create new model. * @param integer $video_id * @param integer $user_id * @return Video Action the loaded model * @throws NotFoundHttpException */ protected function findVideoAction($video_id, $user_id) { if (Video::findOne($video_id) !== null) { if (($model = VideoAction::find()->where(['video_id' => $video_id, 'user_id' => $user_id])->one()) !== null) { return $model; } else { return new VideoAction(); } } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Finds the Video model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Video the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Video::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException(Yii::t('app', 'The requested page does not exist.')); } }
/** * Finds the Video model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @param integer $course_id * @return Video the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id, $course_id) { if (($model = Video::findOne(['id' => $id, 'course_id' => $course_id])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }