Code Duplication    Length = 8-9 lines in 4 locations

app/Models/ProjectModel.php 1 location

@@ 77-84 (lines=8) @@
74
     *
75
     * @return array
76
     */
77
    public function getByIdWithOwner($project_id)
78
    {
79
        return $this->db->table(self::TABLE)
80
            ->columns(self::TABLE.'.*', UserModel::TABLE.'.username AS owner_username', UserModel::TABLE.'.name AS owner_name')
81
            ->eq(self::TABLE.'.id', $project_id)
82
            ->join(UserModel::TABLE, 'id', 'owner_id')
83
            ->findOne();
84
    }
85
86
    /**
87
     * Get a project by the name.

app/Models/ProjectStarModel.php 1 location

@@ 137-145 (lines=9) @@
134
     *
135
     * @return array
136
     */
137
    public function getProjects($user_id)
138
    {
139
        return $this->db->table(self::TABLE)
140
            ->columns(ProjectModel::TABLE.'.id', ProjectModel::TABLE.'.name')
141
            ->join(ProjectModel::TABLE, 'id', 'project_id')
142
            ->eq(self::TABLE.'.user_id', $user_id)
143
            ->asc(ProjectModel::TABLE.'.name')
144
            ->findAll();
145
    }
146
}
147

app/Models/TaskFinderModel.php 1 location

@@ 190-198 (lines=9) @@
187
     *
188
     * @return array
189
     */
190
    public function getAllIds($project_id, array $status = [TaskModel::STATUS_OPEN])
191
    {
192
        return $this->db
193
                    ->table(TaskModel::TABLE)
194
                    ->eq(TaskModel::TABLE.'.project_id', $project_id)
195
                    ->in(TaskModel::TABLE.'.is_active', $status)
196
                    ->asc(TaskModel::TABLE.'.id')
197
                    ->findAllByColumn(TaskModel::TABLE.'.id');
198
    }
199
200
    /**
201
     * Get overdue tasks query.

app/Models/TaskTagModel.php 1 location

@@ 36-43 (lines=8) @@
33
     *
34
     * @return array
35
     */
36
    public function getTagIdsByTaskNotAvailableInProject($task_id, $project_id)
37
    {
38
        return $this->db->table(TagModel::TABLE)
39
            ->eq(self::TABLE.'.task_id', $task_id)
40
            ->notIn(TagModel::TABLE.'.project_id', [0, $project_id])
41
            ->join(self::TABLE, 'tag_id', 'id')
42
            ->findAllByColumn(TagModel::TABLE.'.id');
43
    }
44
45
    /**
46
     * Get all tags associated to a task.