summaryrefslogtreecommitdiff
path: root/app/Filter
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-12-03 12:56:12 -0500
committerFrederic Guillot <fred@kanboard.net>2016-12-03 12:56:12 -0500
commit23d862aef8891130bc7eaeaa25513a9895b44c95 (patch)
tree85331881d6d36e3e358e3b6eb02ec32cf451648e /app/Filter
parent4b22db5400cc5b30696560cd4fc5e44ec845168c (diff)
Add suggest menu for task ID
Diffstat (limited to 'app/Filter')
-rw-r--r--app/Filter/TaskStartsWithIdFilter.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/app/Filter/TaskStartsWithIdFilter.php b/app/Filter/TaskStartsWithIdFilter.php
new file mode 100644
index 00000000..8b7cc678
--- /dev/null
+++ b/app/Filter/TaskStartsWithIdFilter.php
@@ -0,0 +1,38 @@
+<?php
+
+namespace Kanboard\Filter;
+
+use Kanboard\Core\Filter\FilterInterface;
+use Kanboard\Model\TaskModel;
+
+/**
+ * Class TaskIdSearchFilter
+ *
+ * @package Kanboard\Filter
+ * @author Frederic Guillot
+ */
+class TaskStartsWithIdFilter extends BaseFilter implements FilterInterface
+{
+ /**
+ * Get search attribute
+ *
+ * @access public
+ * @return string[]
+ */
+ public function getAttributes()
+ {
+ return array('starts_with_id');
+ }
+
+ /**
+ * Apply filter
+ *
+ * @access public
+ * @return FilterInterface
+ */
+ public function apply()
+ {
+ $this->query->ilike('CAST('.TaskModel::TABLE.'.id AS CHAR(8))', $this->value.'%');
+ return $this;
+ }
+}