Exemplo n.º 1
0
 public function search($params)
 {
     $query = new \yii\db\Query();
     $dataProvider = new ActiveDataProvider(['query' => $query->from(SqlTracePersqlSearch::tableName()), 'db' => self::getDb(), 'pagination' => ['pageSize' => 50]]);
     $query->orderBy('amount desc');
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     if ($this->sqlquerytime) {
         $this->start_date = $this->sqlquerytime;
         $this->end_date = date('Y-m-d 00:00:00', strtotime('+1 day', strtotime($this->sqlquerytime)));
     }
     $query->andFilterWhere(['databasetype' => $this->databasetype]);
     $query->andFilterWhere(['sqlquerytime' => $this->start_date]);
     $query->orderBy('amount desc');
     return $dataProvider;
 }