/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PppTable::find(); $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; } $query->andFilterWhere(['id_oper' => $this->id_oper, 'date' => $this->date, 'ocenka' => $this->ocenka, 'com' => $this->com]); $query->andFilterWhere(['like', 'name_s', $this->name_s])->andFilterWhere(['like', 'name_m', $this->name_m])->andFilterWhere(['like', 'name_o', $this->name_o]); return $dataProvider; }
public function actionMass() { $model = new PppTable(); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->db->createCommand()->batchInsert('ppp_table', ['name_s', 'name_m', 'name_o', 'ocenka', 'com'], [['asd', 'asd', 'asd', 4.5, 30], ['asd', 'asd', 'asd', 4.5, 30], ['asd', 'asd', 'asd', 4.5, 30]])->execute(); return $this->redirect(['view', 'id' => $model->id_oper]); } else { return $this->render('mass', ['model' => $model]); } }