blob: 4f8896745d80fb40253ff1602488ea47a43d24cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<?php
namespace Kanboard\Formatter;
/**
* Class TaskListSubtaskFormatter
*
* @package Kanboard\Formatter
* @author Frederic Guillot
*/
class TaskListSubtaskFormatter extends TaskListFormatter
{
/**
* Apply formatter
*
* @access public
* @return array
*/
public function format()
{
$tasks = parent::format();
$taskIds = array_column($tasks, 'id');
$subtasks = $this->subtaskModel->getAllByTaskIds($taskIds);
$subtasks = array_column_index($subtasks, 'task_id');
array_merge_relation($tasks, $subtasks, 'subtasks', 'id');
return $tasks;
}
}
|