diff options
Diffstat (limited to 'app/Formatter')
-rw-r--r-- | app/Formatter/TaskListFormatter.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/Formatter/TaskListFormatter.php b/app/Formatter/TaskListFormatter.php new file mode 100644 index 00000000..01fbbae0 --- /dev/null +++ b/app/Formatter/TaskListFormatter.php @@ -0,0 +1,30 @@ +<?php + +namespace Kanboard\Formatter; + +use Kanboard\Core\Filter\FormatterInterface; + +/** + * Class TaskListFormatter + * + * @package Kanboard\Formatter + * @author Frederic Guillot + */ +class TaskListFormatter extends BaseFormatter implements FormatterInterface +{ + /** + * Apply formatter + * + * @access public + * @return mixed + */ + public function format() + { + $tasks = $this->query->findAll(); + $taskIds = array_column($tasks, 'id'); + $tags = $this->taskTagModel->getTagsByTasks($taskIds); + array_merge_relation($tasks, $tags, 'tags', 'id'); + + return $tasks; + } +} |