/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = StrukturnoePodrazdelenie::find();
     $query->joinWith(['organizaciya0']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['attributes' => ['nazvanie', 'sokrashennoe_nazvanie', 'obschij', 'organizaciyaNazvanie' => ['asc' => ['organizaciya.nazvanie' => SORT_ASC], 'desc' => ['organizaciya.nazvanie' => SORT_DESC], 'label' => 'Организация']]]);
     $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(['strukturnoe_podrazdelenie.obschij' => $this->obschij]);
     $query->andFilterWhere(['like', 'strukturnoe_podrazdelenie.nazvanie', $this->nazvanie])->andFilterWhere(['like', 'strukturnoe_podrazdelenie.sokrashennoe_nazvanie', $this->sokrashennoe_nazvanie])->andFilterWhere(['like', 'organizaciya.nazvanie', $this->organizaciyaNazvanie]);
     return $dataProvider;
 }