コード例 #1
0
 public function actionIndex($slug)
 {
     $vidmage = Vidmage::findOne(['slug' => $slug]);
     $meme = $vidmage->memeVidmages[0]->meme;
     $query = Vidmage::find()->joinWith('memeVidmages.meme')->where(['meme.id' => $meme->id])->andWhere(['meme_vidmage.is_the_origin' => false])->andWhere(['<>', 'vidmage_id', $vidmage->id]);
     $vidmages = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     return $this->render('index', compact('vidmage', 'meme', 'vidmages'));
 }
コード例 #2
0
 /**
  * Finds the Vidmage model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Vidmage the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Vidmage::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }