/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = EventsSet::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, '{{%sport}}.url_key' => $this->url_key]);
     $query->andFilterWhere(['like', '{{%events_set}}.name', $this->name]);
     $query->joinWith(['sport']);
     $query->joinWith(['events']);
     return $dataProvider;
 }
Exemplo n.º 2
0
<div class="competition-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'sport_id')->dropDownList(ArrayHelper::map(Sport::find()->all(), 'id', 'name'));
?>

    <?php 
echo $form->field($model, 'events_set_id')->dropDownList(ArrayHelper::map(EventsSet::find()->all(), 'id', 'name'));
?>

    <?php 
echo $form->field($model, 'date_start')->widget(DatePicker::classname(), ['dateFormat' => 'yyyy-MM-dd']);
?>

    <?php 
echo $form->field($model, 'date_finish')->widget(DatePicker::classname(), ['dateFormat' => 'yyyy-MM-dd']);
?>

    <?php 
echo $form->field($model, 'location')->textInput(['maxlength' => true]);
?>

    <div class="form-group">