1 | <?php |
||
27 | trait RelationTrait |
||
28 | { |
||
29 | /** |
||
30 | * An issue has one user assigned to (inverse relationship of User::issues). |
||
31 | * |
||
32 | * @return Relations\BelongsTo |
||
33 | */ |
||
34 | 11 | public function assigned() |
|
38 | |||
39 | /** |
||
40 | * An issue has one user updated by (inverse relationship of User::issuesUpdatedBy). |
||
41 | * |
||
42 | * @return Relations\BelongsTo |
||
43 | */ |
||
44 | 4 | public function updatedBy() |
|
48 | |||
49 | /** |
||
50 | * An issue has one user closed it (inverse relationship of User::issuesClosedBy). |
||
51 | * |
||
52 | * @return Relations\BelongsTo |
||
53 | */ |
||
54 | public function closer() |
||
58 | |||
59 | /** |
||
60 | * An issue has one user created it (inverse relationship of User::issuesCreatedBy). |
||
61 | * |
||
62 | * @return Relations\BelongsTo |
||
63 | */ |
||
64 | 15 | public function user() |
|
68 | |||
69 | /** |
||
70 | * Issue belong to a project. |
||
71 | * |
||
72 | * @return Relations\BelongsTo |
||
73 | */ |
||
74 | 1 | public function project() |
|
78 | |||
79 | /** |
||
80 | * Issue can have many attachments. |
||
81 | * |
||
82 | * @return Relations\HasMany |
||
83 | */ |
||
84 | 13 | public function attachments() |
|
93 | |||
94 | /** |
||
95 | * Issue have many users activities. |
||
96 | * |
||
97 | * @return Relations\HasMany |
||
98 | */ |
||
99 | 17 | public function activities() |
|
105 | |||
106 | /** |
||
107 | * Issue have many users activities (all except comments). |
||
108 | * |
||
109 | * @return mixed |
||
110 | */ |
||
111 | 1 | public function generalActivities() |
|
118 | |||
119 | /** |
||
120 | * Issue have many users activities (comments). |
||
121 | * |
||
122 | * @return mixed |
||
123 | */ |
||
124 | 6 | public function commentActivities() |
|
131 | |||
132 | /** |
||
133 | * Issue have many tags. |
||
134 | * |
||
135 | * @return Relations\BelongsToMany |
||
136 | */ |
||
137 | 17 | public function tags() |
|
141 | |||
142 | /** |
||
143 | * Issue have many comments. |
||
144 | * |
||
145 | * @return Relations\HasMany |
||
146 | */ |
||
147 | 3 | public function comments() |
|
153 | |||
154 | /** |
||
155 | * Issue can have many messages queue. |
||
156 | * |
||
157 | * @return Relations\HasMany |
||
158 | */ |
||
159 | public function messagesQueue() |
||
163 | } |
||
164 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.