22
33namespace Laddr ;
44
5+ use DB ;
56use HandleBehavior ;
7+ use Tag , TagItem ;
8+ use Comment ;
9+ use Emergence \People \Person ;
10+ use Emergence \People \IPerson ;
11+
612
713class Project extends \VersionedRecord
814{
@@ -28,19 +34,19 @@ class Project extends \VersionedRecord
2834 ],
2935 'MaintainerID ' => [
3036 'type ' => 'uint ' ,
31- 'notnull ' => false
37+ 'default ' => null
3238 ],
3339 'UsersUrl ' => [
3440 'type ' => 'string ' ,
35- 'notnull ' => false
41+ 'default ' => null
3642 ],
3743 'DevelopersUrl ' => [
3844 'type ' => 'string ' ,
39- 'notnull ' => false
45+ 'default ' => null
4046 ],
4147 'README ' => [
4248 'type ' => 'clob ' ,
43- 'notnull ' => false
49+ 'default ' => null
4450 ],
4551 'NextUpdate ' => [
4652 'type ' => 'uint ' ,
@@ -68,11 +74,11 @@ class Project extends \VersionedRecord
6874 public static $ relationships = [
6975 'Maintainer ' => [
7076 'type ' => 'one-one ' ,
71- 'class ' => \ Emergence \ People \ Person::class
77+ 'class ' => Person::class
7278 ],
7379 'Members ' => [
7480 'type ' => 'many-many ' ,
75- 'class ' => \ Emergence \ People \ Person::class,
81+ 'class ' => Person::class,
7682 'linkClass ' => ProjectMember::class,
7783 'linkLocal ' => 'ProjectID ' ,
7884 'linkForeign ' => 'MemberID ' ,
@@ -91,20 +97,20 @@ class Project extends \VersionedRecord
9197 ],
9298 'Comments ' => [
9399 'type ' => 'context-children ' ,
94- 'class ' => \ Comment::class,
100+ 'class ' => Comment::class,
95101 'order ' => ['ID ' => 'DESC ' ]
96102 ],
97103 'Tags ' => [
98104 'type ' => 'many-many ' ,
99- 'class ' => \ Tag::class,
100- 'linkClass ' => \ TagItem::class,
105+ 'class ' => Tag::class,
106+ 'linkClass ' => TagItem::class,
101107 'linkLocal ' => 'ContextID ' ,
102108 'conditions ' => ['Link.ContextClass = "Laddr \\\\Project" ' ]
103109 ],
104110 'TopicTags ' => [
105111 'type ' => 'many-many ' ,
106- 'class ' => \ Tag::class,
107- 'linkClass ' => \ TagItem::class,
112+ 'class ' => Tag::class,
113+ 'linkClass ' => TagItem::class,
108114 'linkLocal ' => 'ContextID ' ,
109115 'conditions ' => [
110116 'Link.ContextClass = "Laddr \\\\Project" ' ,
@@ -113,8 +119,8 @@ class Project extends \VersionedRecord
113119 ],
114120 'TechTags ' => [
115121 'type ' => 'many-many ' ,
116- 'class ' => \ Tag::class,
117- 'linkClass ' => \ TagItem::class,
122+ 'class ' => Tag::class,
123+ 'linkClass ' => TagItem::class,
118124 'linkLocal ' => 'ContextID ' ,
119125 'conditions ' => [
120126 'Link.ContextClass = "Laddr \\\\Project" ' ,
@@ -123,8 +129,8 @@ class Project extends \VersionedRecord
123129 ],
124130 'EventTags ' => [
125131 'type ' => 'many-many ' ,
126- 'class ' => \ Tag::class,
127- 'linkClass ' => \ TagItem::class,
132+ 'class ' => Tag::class,
133+ 'linkClass ' => TagItem::class,
128134 'linkLocal ' => 'ContextID ' ,
129135 'conditions ' => [
130136 'Link.ContextClass = "Laddr \\\\Project" ' ,
@@ -194,7 +200,7 @@ public function save($deep = true)
194200 }
195201 }
196202
197- public function hasMember (\ Emergence \ People \ IPerson $ Person )
203+ public function hasMember (IPerson $ Person )
198204 {
199205 foreach ($ this ->Members AS $ Member ) {
200206 if ($ Member ->ID == $ Person ->ID ) {
@@ -211,28 +217,28 @@ public function getActivity($limit = null)
211217
212218 // retrieve updates and buzz metadata from database
213219 try {
214- $ updates = \ DB ::allRecords (
220+ $ updates = DB ::allRecords (
215221 'SELECT ID, Class, UNIX_TIMESTAMP(Created) AS Timestamp FROM `%s` WHERE ProjectID = %u ORDER BY Timestamp DESC %s ' ,
216222 [
217223 ProjectUpdate::$ tableName ,
218224 $ this ->ID ,
219225 $ limitSql
220226 ]
221227 );
222- } catch (\ TableNotFoundException $ e ) {
228+ } catch (TableNotFoundException $ e ) {
223229 $ updates = [];
224230 }
225231
226232 try {
227- $ buzz = \ DB ::allRecords (
233+ $ buzz = DB ::allRecords (
228234 'SELECT ID, Class, UNIX_TIMESTAMP(Published) AS Timestamp FROM `%s` WHERE ProjectID = %u ORDER BY Timestamp DESC %s ' ,
229235 [
230236 ProjectBuzz::$ tableName ,
231237 $ this ->ID ,
232238 $ limitSql
233239 ]
234240 );
235- } catch (\ TableNotFoundException $ e ) {
241+ } catch (TableNotFoundException $ e ) {
236242 $ buzz = [];
237243 }
238244
@@ -262,13 +268,13 @@ function($result) {
262268 public static function getStagesSummary ()
263269 {
264270 try {
265- $ stages = \ DB ::allRecords (
271+ $ stages = DB ::allRecords (
266272 'SELECT Stage, COUNT(*) AS itemsCount FROM `%s` GROUP BY Stage ORDER BY itemsCount DESC ' ,
267273 [
268274 static ::$ tableName
269275 ]
270276 );
271- } catch (\ TableNotFoundException $ e ) {
277+ } catch (TableNotFoundException $ e ) {
272278 $ stages = [];
273279 }
274280
0 commit comments