コード例 #1
0
 /**
  * @param int $id
  *
  * @return Character
  * @throws NotFoundHttpException
  */
 public function loadCharacter($id)
 {
     /** @var Character $character */
     $model = Character::find()->joinWith('api')->where(['api_account_characters.characterID' => $id, 'api.userID' => \Yii::$app->user->id])->one();
     if (!$model) {
         throw new NotFoundHttpException('Such character does not exist.');
     }
     return $model;
 }
コード例 #2
0
 /**
  * @return string
  */
 public function actionList()
 {
     $this->getView()->addBread('List');
     $characters = Character::find()->joinWith('api')->where(['api.userID' => \Yii::$app->user->id])->all();
     return $this->render('list', ['characters' => $characters]);
 }