/** * Поиск отзыва по ключу * @param integer $id * @return Review the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (!Yii::$app->user->isGuest) { $model = Review::findOne($id); } else { $model = Yii::$app->db->cache(function ($db) use($id) { return Review::findOne($id); }, Yii::$app->params['dbCacheValidTime']); } if ($model !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }