Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 public function actionStyle()
 {
     $styles = Style::find()->all();
     return $this->render('style', ['model' => $styles]);
 }
Ejemplo n.º 3
0
 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');
 }