Example #1
0
 /**
  * @param \yii\web\Request $request
  * @return integer|null
  */
 private function getNoteAuthorId($request)
 {
     $noteId = $request->get('id');
     /** @var $note Note|null */
     $note = Note::findOne($noteId);
     return isset($note) ? $note->author_id : null;
 }
Example #2
0
 /**
  * Finds the Note model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Note the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Note::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }