2
2
3
3
namespace Laddr ;
4
4
5
+ use DB ;
5
6
use HandleBehavior ;
7
+ use Tag , TagItem ;
8
+ use Comment ;
9
+ use Emergence \People \Person ;
10
+ use Emergence \People \IPerson ;
11
+
6
12
7
13
class Project extends \VersionedRecord
8
14
{
@@ -28,19 +34,19 @@ class Project extends \VersionedRecord
28
34
],
29
35
'MaintainerID ' => [
30
36
'type ' => 'uint ' ,
31
- 'notnull ' => false
37
+ 'default ' => null
32
38
],
33
39
'UsersUrl ' => [
34
40
'type ' => 'string ' ,
35
- 'notnull ' => false
41
+ 'default ' => null
36
42
],
37
43
'DevelopersUrl ' => [
38
44
'type ' => 'string ' ,
39
- 'notnull ' => false
45
+ 'default ' => null
40
46
],
41
47
'README ' => [
42
48
'type ' => 'clob ' ,
43
- 'notnull ' => false
49
+ 'default ' => null
44
50
],
45
51
'NextUpdate ' => [
46
52
'type ' => 'uint ' ,
@@ -68,11 +74,11 @@ class Project extends \VersionedRecord
68
74
public static $ relationships = [
69
75
'Maintainer ' => [
70
76
'type ' => 'one-one ' ,
71
- 'class ' => \ Emergence \ People \ Person::class
77
+ 'class ' => Person::class
72
78
],
73
79
'Members ' => [
74
80
'type ' => 'many-many ' ,
75
- 'class ' => \ Emergence \ People \ Person::class,
81
+ 'class ' => Person::class,
76
82
'linkClass ' => ProjectMember::class,
77
83
'linkLocal ' => 'ProjectID ' ,
78
84
'linkForeign ' => 'MemberID ' ,
@@ -91,20 +97,20 @@ class Project extends \VersionedRecord
91
97
],
92
98
'Comments ' => [
93
99
'type ' => 'context-children ' ,
94
- 'class ' => \ Comment::class,
100
+ 'class ' => Comment::class,
95
101
'order ' => ['ID ' => 'DESC ' ]
96
102
],
97
103
'Tags ' => [
98
104
'type ' => 'many-many ' ,
99
- 'class ' => \ Tag::class,
100
- 'linkClass ' => \ TagItem::class,
105
+ 'class ' => Tag::class,
106
+ 'linkClass ' => TagItem::class,
101
107
'linkLocal ' => 'ContextID ' ,
102
108
'conditions ' => ['Link.ContextClass = "Laddr \\\\Project" ' ]
103
109
],
104
110
'TopicTags ' => [
105
111
'type ' => 'many-many ' ,
106
- 'class ' => \ Tag::class,
107
- 'linkClass ' => \ TagItem::class,
112
+ 'class ' => Tag::class,
113
+ 'linkClass ' => TagItem::class,
108
114
'linkLocal ' => 'ContextID ' ,
109
115
'conditions ' => [
110
116
'Link.ContextClass = "Laddr \\\\Project" ' ,
@@ -113,8 +119,8 @@ class Project extends \VersionedRecord
113
119
],
114
120
'TechTags ' => [
115
121
'type ' => 'many-many ' ,
116
- 'class ' => \ Tag::class,
117
- 'linkClass ' => \ TagItem::class,
122
+ 'class ' => Tag::class,
123
+ 'linkClass ' => TagItem::class,
118
124
'linkLocal ' => 'ContextID ' ,
119
125
'conditions ' => [
120
126
'Link.ContextClass = "Laddr \\\\Project" ' ,
@@ -123,8 +129,8 @@ class Project extends \VersionedRecord
123
129
],
124
130
'EventTags ' => [
125
131
'type ' => 'many-many ' ,
126
- 'class ' => \ Tag::class,
127
- 'linkClass ' => \ TagItem::class,
132
+ 'class ' => Tag::class,
133
+ 'linkClass ' => TagItem::class,
128
134
'linkLocal ' => 'ContextID ' ,
129
135
'conditions ' => [
130
136
'Link.ContextClass = "Laddr \\\\Project" ' ,
@@ -194,7 +200,7 @@ public function save($deep = true)
194
200
}
195
201
}
196
202
197
- public function hasMember (\ Emergence \ People \ IPerson $ Person )
203
+ public function hasMember (IPerson $ Person )
198
204
{
199
205
foreach ($ this ->Members AS $ Member ) {
200
206
if ($ Member ->ID == $ Person ->ID ) {
@@ -211,28 +217,28 @@ public function getActivity($limit = null)
211
217
212
218
// retrieve updates and buzz metadata from database
213
219
try {
214
- $ updates = \ DB ::allRecords (
220
+ $ updates = DB ::allRecords (
215
221
'SELECT ID, Class, UNIX_TIMESTAMP(Created) AS Timestamp FROM `%s` WHERE ProjectID = %u ORDER BY Timestamp DESC %s ' ,
216
222
[
217
223
ProjectUpdate::$ tableName ,
218
224
$ this ->ID ,
219
225
$ limitSql
220
226
]
221
227
);
222
- } catch (\ TableNotFoundException $ e ) {
228
+ } catch (TableNotFoundException $ e ) {
223
229
$ updates = [];
224
230
}
225
231
226
232
try {
227
- $ buzz = \ DB ::allRecords (
233
+ $ buzz = DB ::allRecords (
228
234
'SELECT ID, Class, UNIX_TIMESTAMP(Published) AS Timestamp FROM `%s` WHERE ProjectID = %u ORDER BY Timestamp DESC %s ' ,
229
235
[
230
236
ProjectBuzz::$ tableName ,
231
237
$ this ->ID ,
232
238
$ limitSql
233
239
]
234
240
);
235
- } catch (\ TableNotFoundException $ e ) {
241
+ } catch (TableNotFoundException $ e ) {
236
242
$ buzz = [];
237
243
}
238
244
@@ -262,13 +268,13 @@ function($result) {
262
268
public static function getStagesSummary ()
263
269
{
264
270
try {
265
- $ stages = \ DB ::allRecords (
271
+ $ stages = DB ::allRecords (
266
272
'SELECT Stage, COUNT(*) AS itemsCount FROM `%s` GROUP BY Stage ORDER BY itemsCount DESC ' ,
267
273
[
268
274
static ::$ tableName
269
275
]
270
276
);
271
- } catch (\ TableNotFoundException $ e ) {
277
+ } catch (TableNotFoundException $ e ) {
272
278
$ stages = [];
273
279
}
274
280
0 commit comments