@@ 36-56 (lines=21) @@ | ||
33 | * |
|
34 | * @return array|null |
|
35 | */ |
|
36 | public function getById($project_id, $restriction_id) |
|
37 | { |
|
38 | return $this->db |
|
39 | ->table(self::TABLE) |
|
40 | ->columns( |
|
41 | self::TABLE.'.restriction_id', |
|
42 | self::TABLE.'.project_id', |
|
43 | self::TABLE.'.role_id', |
|
44 | self::TABLE.'.src_column_id', |
|
45 | self::TABLE.'.dst_column_id', |
|
46 | 'pr.role', |
|
47 | 'sc.title as src_column_title', |
|
48 | 'dc.title as dst_column_title' |
|
49 | ) |
|
50 | ->left(ColumnModel::TABLE, 'sc', 'id', self::TABLE, 'src_column_id') |
|
51 | ->left(ColumnModel::TABLE, 'dc', 'id', self::TABLE, 'dst_column_id') |
|
52 | ->left(ProjectRoleModel::TABLE, 'pr', 'role_id', self::TABLE, 'role_id') |
|
53 | ->eq(self::TABLE.'.project_id', $project_id) |
|
54 | ->eq(self::TABLE.'.restriction_id', $restriction_id) |
|
55 | ->findOne(); |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * Get all project column restrictions. |
|
@@ 65-84 (lines=20) @@ | ||
62 | * |
|
63 | * @return array |
|
64 | */ |
|
65 | public function getAll($project_id) |
|
66 | { |
|
67 | return $this->db |
|
68 | ->table(self::TABLE) |
|
69 | ->columns( |
|
70 | self::TABLE.'.restriction_id', |
|
71 | self::TABLE.'.project_id', |
|
72 | self::TABLE.'.role_id', |
|
73 | self::TABLE.'.src_column_id', |
|
74 | self::TABLE.'.dst_column_id', |
|
75 | 'pr.role', |
|
76 | 'sc.title as src_column_title', |
|
77 | 'dc.title as dst_column_title' |
|
78 | ) |
|
79 | ->left(ColumnModel::TABLE, 'sc', 'id', self::TABLE, 'src_column_id') |
|
80 | ->left(ColumnModel::TABLE, 'dc', 'id', self::TABLE, 'dst_column_id') |
|
81 | ->left(ProjectRoleModel::TABLE, 'pr', 'role_id', self::TABLE, 'role_id') |
|
82 | ->eq(self::TABLE.'.project_id', $project_id) |
|
83 | ->findAll(); |
|
84 | } |
|
85 | ||
86 | /** |
|
87 | * Get all sortable column Ids. |