/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Style::find(); $pageSize = Yii::$app->session->get('pageSize', 20); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize]]); $dataProvider->setSort(['attributes' => ['s_id', 's_b_id', 's_p_id', 'bankName' => ['asc' => ['{{%bank}}.bezeichnung' => SORT_ASC], 'desc' => ['{{%bank}}.bezeichnung' => SORT_DESC], 'label' => 'Bankenname'], 'groupName' => ['asc' => ['{{%personen}}.bezeichnung' => SORT_ASC], 'desc' => ['{{%personen}}.bezeichnung' => SORT_DESC], 'label' => 'Gruppenname'], 'style']]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['like', 'style', $this->style]); $query->joinWith(['bank' => function ($q) { $q->where('{{%bank}}.bezeichnung LIKE "%' . $this->bankName . '%"'); }]); $query->joinWith(['group' => function ($q) { $q->where('{{%personen}}.bezeichnung LIKE "%' . $this->groupName . '%"'); }]); return $dataProvider; }
public function actionStyle() { $styles = Style::find()->all(); return $this->render('style', ['model' => $styles]); }
public function testExistDefault() { $style = Style::find()->where(['name' => 'default'])->one(); expect('name should be like search', $style->name)->equals('default'); expect('title should be like fixtures', $style->title)->equals('title-default'); }