diff options
author | Rafael de Camargo <rafacamargo123@gmail.com> | 2019-08-25 01:49:52 -0300 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2019-08-27 20:28:58 -0700 |
commit | 51b3d811e180656f7cc3ca75e071ceaef2d5bd46 (patch) | |
tree | b6ac7fa2d18d7d5883a126cafbcba583c09f557d /app/Filter/TaskCommentFilter.php | |
parent | 4d0762805448d285c2e6fba12a71b71c22496e13 (diff) |
Changes filters from in array to in subqueries
Fixes #3280
Diffstat (limited to 'app/Filter/TaskCommentFilter.php')
-rw-r--r-- | app/Filter/TaskCommentFilter.php | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/app/Filter/TaskCommentFilter.php b/app/Filter/TaskCommentFilter.php index 1bb230e9..e5d91117 100644 --- a/app/Filter/TaskCommentFilter.php +++ b/app/Filter/TaskCommentFilter.php @@ -55,13 +55,7 @@ class TaskCommentFilter extends BaseFilter implements FilterInterface */ public function apply() { - $task_ids = $this->getTaskIdsWithGivenComment(); - - if (empty($task_ids)) { - $task_ids = array(-1); - } - - $this->query->in(TaskModel::TABLE.'.id', $task_ids); + $this->query->inSubquery(TaskModel::TABLE.'.id', $this->getSubQuery()); return $this; } @@ -72,11 +66,11 @@ class TaskCommentFilter extends BaseFilter implements FilterInterface * @access public * @return array */ - protected function getTaskIdsWithGivenComment() + protected function getSubQuery() { return $this->db ->table(CommentModel::TABLE) - ->ilike(CommentModel::TABLE.'.comment', '%'.$this->value.'%') - ->findAllByColumn(CommentModel::TABLE.'.task_id'); + ->columns(CommentModel::TABLE.'.task_id') + ->ilike(CommentModel::TABLE.'.comment', '%'.$this->value.'%'); } } |