コード例 #1
0
 public function getAllTeamSeason()
 {
     $model = Teams::find()->where(['name' => Yii::$app->params['main-team']])->with('seasonDetails')->one();
     $season_id = $model->seasonDetails;
     //        var_dump($season_id);die;
     return ArrayHelper::map(Seasons::find()->select(['id', 'full_name'])->where(['status' => 'on', 'id' => $season_id])->asArray()->all(), 'id', 'full_name');
 }
コード例 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Seasons::find()->orderBy('id DESC');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'full_name', $this->full_name])->andFilterWhere(['like', 'division', $this->division])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'status', $this->status]);
     return $dataProvider;
 }
コード例 #3
0
ファイル: Games.php プロジェクト: kusma007/one-advanced
 public function getAllSeasons()
 {
     return Seasons::find()->all();
 }
コード例 #4
0
 /**
  * Finds the Seasons model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Seasons the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Seasons::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }