@@ 68-83 (lines=16) @@ | ||
65 | * |
|
66 | * @return Table |
|
67 | */ |
|
68 | public function getQuery() |
|
69 | { |
|
70 | return $this |
|
71 | ->db |
|
72 | ->table(self::TABLE) |
|
73 | ->columns( |
|
74 | self::TABLE.'.*', |
|
75 | 'uc.username AS author_username', |
|
76 | 'uc.name AS author_name', |
|
77 | 'uc.email', |
|
78 | 'uc.avatar_path' |
|
79 | ) |
|
80 | ->join(TaskModel::TABLE, 'id', 'task_id') |
|
81 | ->join(ProjectModel::TABLE, 'id', 'project_id') |
|
82 | ->left(UserModel::TABLE, 'uc', 'id', self::TABLE, 'creator_id'); |
|
83 | } |
|
84 | ||
85 | /** |
|
86 | * Remove old event entries to avoid large table. |
@@ 338-352 (lines=15) @@ | ||
335 | * |
|
336 | * @return \PicoDb\Table |
|
337 | */ |
|
338 | public function getICalQuery() |
|
339 | { |
|
340 | return $this->db->table(TaskModel::TABLE) |
|
341 | ->left(UserModel::TABLE, 'ua', 'id', TaskModel::TABLE, 'owner_id') |
|
342 | ->left(UserModel::TABLE, 'uc', 'id', TaskModel::TABLE, 'creator_id') |
|
343 | ->columns( |
|
344 | TaskModel::TABLE.'.*', |
|
345 | 'ua.email AS assignee_email', |
|
346 | 'ua.name AS assignee_name', |
|
347 | 'ua.username AS assignee_username', |
|
348 | 'uc.email AS creator_email', |
|
349 | 'uc.name AS creator_name', |
|
350 | 'uc.username AS creator_username' |
|
351 | ); |
|
352 | } |
|
353 | ||
354 | /** |
|
355 | * Count all tasks for a given project and status. |