1 | <?php |
||
26 | trait RelationTrait |
||
27 | { |
||
28 | /** |
||
29 | * A user has one role (inverse relationship of Role::users). |
||
30 | * |
||
31 | * @return Relations\BelongsTo |
||
32 | */ |
||
33 | 29 | public function role() |
|
37 | |||
38 | /** |
||
39 | * User has many comments (One-many relationship of Comment::user). |
||
40 | * |
||
41 | * @return Relations\HasMany |
||
42 | */ |
||
43 | public function comments() |
||
47 | |||
48 | /** |
||
49 | * Returns issues created by the user. |
||
50 | * |
||
51 | * @return Relations\HasMany |
||
52 | */ |
||
53 | 2 | public function issuesCreatedBy() |
|
54 | { |
||
55 | 2 | return $this->hasMany('Tinyissue\Model\Project\Issue', 'created_by'); |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * Returns issues closed by the user. |
||
60 | * |
||
61 | * @return Relations\HasMany |
||
62 | */ |
||
63 | public function issuesClosedBy() |
||
67 | |||
68 | /** |
||
69 | * Returns issues updated by the user. |
||
70 | * |
||
71 | * @return Relations\HasMany |
||
72 | */ |
||
73 | public function issuesUpdatedBy() |
||
77 | |||
78 | /** |
||
79 | * User has many attachments (One-many relationship of Attachment::user). |
||
80 | * |
||
81 | * @return Relations\HasMany |
||
82 | */ |
||
83 | public function attachments() |
||
87 | |||
88 | /** |
||
89 | * Returns all projects the user can access. |
||
90 | * |
||
91 | * @param int $status |
||
92 | * |
||
93 | * @return Relations\HasMany |
||
94 | */ |
||
95 | 30 | public function projects($status = Project::STATUS_OPEN) |
|
102 | |||
103 | /** |
||
104 | * User has many issues assigned to (One-many relationship of Issue::assigned). |
||
105 | * |
||
106 | * @return Relations\HasMany |
||
107 | */ |
||
108 | 19 | public function issues() |
|
112 | |||
113 | /** |
||
114 | * Returns all permission for the user. |
||
115 | * |
||
116 | * @return Relations\HasMany |
||
117 | */ |
||
118 | 60 | public function permissions() |
|
122 | } |
||
123 |