/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Issue::find()->joinWith(['author', 'project', 'checkLists']); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 50], 'sort' => ['defaultOrder' => ['priority_id' => SORT_DESC, 'id' => SORT_DESC]]]); $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, 'tracker_id' => $this->tracker_id, 'status_id' => $this->status_id, 'priority_id' => $this->priority_id, 'assignee_id' => $this->assignee_id, 'deadline' => $this->deadline, 'readiness_id' => $this->readiness_id, 'project_id' => $this->project_id, 'issue.creator_id' => $this->creator_id, 'milestone_id' => $this->milestone_id, 'created_date' => $this->created_date, 'updated_date' => $this->updated_date]); $query->andFilterWhere(['like', 'subject', $this->subject])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Issue::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, 'tracker_id' => $this->tracker_id, 'project_id' => $this->project_id, 'issue_category_id' => $this->issue_category_id, 'user_id' => $this->user_id, 'issue_priority_id' => $this->issue_priority_id, 'version_id' => $this->version_id, 'assigned_to' => $this->assigned_to, 'created' => $this->created, 'modified' => $this->modified, 'done_ratio' => $this->done_ratio, 'closed' => $this->closed, 'pre_done_ratio' => $this->pre_done_ratio, 'updated_by' => $this->updated_by, 'last_comment' => $this->last_comment]); $query->andFilterWhere(['like', 'subject', $this->subject])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'status', $this->status]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Issue::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]); $query->andFilterWhere(['like', 'yes', $this->yes])->andFilterWhere(['like', 'no', $this->no])->andFilterWhere(['like', 'sum', $this->sum])->andFilterWhere(['like', 'plus', $this->plus]); return $dataProvider; }
public function actionGetIssuesJson() { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; return ['New' => Issue::find()->where('status_id IN (' . implode(',', StatusEnum::getOpenStatuses()) . ')')->orderBy('id DESC')->limit(self::ISSUE_LIMIT)->all(), 'In work' => Issue::find()->where(['status_id' => StatusEnum::IN_WORK])->orderBy('id DESC')->limit(self::ISSUE_LIMIT)->all(), 'Closed' => Issue::find()->where('status_id IN (' . implode(',', StatusEnum::getClosedStatuses()) . ')')->orderBy('id DESC')->limit(self::ISSUE_LIMIT)->all()]; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function delete($id) { //Soft delete the item $issue = Issue::find($id); $issue->delete(); // redirect return redirect()->to('issue.index')->with('message', trans('messages.issue-succesfully-deleted')); }