/**
  * Finds the Transfer model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Transfer the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Transfer::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #2
0
 /**
  * Url: /transfer/{$id}
  * @param int $id Transfer id
  * @return mixed
  * @throws NotFoundHttpException
  */
 public function actionTransfer($id)
 {
     $transfer = Transfer::findOne($id);
     if (!isset($transfer)) {
         throw new NotFoundHttpException('Страница не найдена.');
     }
     return $this->render('@frontend/views/site/index', ['templateType' => 'col2', 'title' => 'Dynamomania.com | Трансферы | ' . $transfer->player->name, 'columnFirst' => ['transfers' => ['view' => '@frontend/views/transfers/transfer_single', 'data' => compact('transfer')], 'comments' => Comment::getCommentsBlock($transfer->id, Comment::COMMENTABLE_TRANSFER)], 'columnSecond' => ['short_news' => SiteBlock::getShortNews(10)]]);
 }