コード例 #1
0
 public function actionView($id)
 {
     // For the simple view
     $model = $this->findModel($id);
     // For the GridView
     $searchModel = new TableTwoSearch(['t1_id' => $id]);
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     // For the ListView
     // $modelForListView = $this->loadModel($id);
     // $query = TableTwo::find(['t1_id' => $id]);
     // $dataProviderForListView = new ActiveDataProvider([
     //     'query' => $query,
     //     'pagination' => [
     //         'pageSize' => 10,
     //     ],
     // ]);
     return $this->render('view', ['model' => $model, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
コード例 #2
0
 /**
  * Lists all TableTwo models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new TableTwoSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }