コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::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' => $this->id, 'plugin_id' => $this->plugin_id, 'app_id' => $this->app_id, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'trigger_class', $this->trigger_class])->andFilterWhere(['like', 'trigger_event', $this->trigger_event])->andFilterWhere(['like', 'handler_method', $this->handler_method]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Delete events
  * @param array $data
  * @return bool
  */
 protected function deleteEvent($data)
 {
     foreach (Event::find()->where($data)->all() as $event) {
         $event->delete();
     }
 }