Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Release::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['date' => SORT_ASC]]]);
     $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, 'artist_id' => $this->artist_id, 'date' => $this->date]);
     $query->andFilterWhere(['like', 'original_name', $this->original_name])->andFilterWhere(['like', 'latin_name', $this->latin_name])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'info', $this->info]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function actionReleases()
 {
     return $this->render('releases', ['releases' => Release::find()->all()]);
 }
Ejemplo n.º 3
0
 /**
  * Lists all Release models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Release::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }