Skip to content

Commit 749aa7e

Browse files
Update class syntax
1 parent 86b6815 commit 749aa7e

File tree

4 files changed

+45
-31
lines changed

4 files changed

+45
-31
lines changed

php-classes/Laddr/MemberCheckin.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Laddr;
44

5+
use Emergence\People\Person;
6+
7+
58
class MemberCheckin extends \ActiveRecord
69
{
710
// ActiveRecord configuration
@@ -16,18 +19,18 @@ class MemberCheckin extends \ActiveRecord
1619
'MemberID' => 'uint',
1720
'ProjectID' => [
1821
'type' => 'uint',
19-
'notnull' => false
22+
'default' => null
2023
],
2124
'MeetupID' => [
2225
'type' => 'string',
23-
'notnull' => false
26+
'default' => null
2427
]
2528
];
2629

2730
public static $relationships = [
2831
'Member' => [
2932
'type' => 'one-one',
30-
'class' => \Emergence\People\Person::class
33+
'class' => \Person::class
3134
],
3235
'Project' => [
3336
'type' => 'one-one',

php-classes/Laddr/Project.php

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
namespace Laddr;
44

5+
use DB;
56
use HandleBehavior;
7+
use Tag, TagItem;
8+
use Comment;
9+
use Emergence\People\Person;
10+
use Emergence\People\IPerson;
11+
612

713
class 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

php-classes/Laddr/ProjectBuzz.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Laddr;
44

55
use HandleBehavior;
6+
use Media;
7+
68

79
class ProjectBuzz extends \ActiveRecord
810
{
@@ -29,11 +31,11 @@ class ProjectBuzz extends \ActiveRecord
2931
'Published' => 'timestamp',
3032
'ImageID' => [
3133
'type' => 'uint',
32-
'notnull' => false
34+
'default' => null
3335
],
3436
'Summary' => [
3537
'type' => 'clob',
36-
'notnull' => false
38+
'default' => null
3739
]
3840
];
3941

@@ -44,7 +46,7 @@ class ProjectBuzz extends \ActiveRecord
4446
],
4547
'Image' => [
4648
'type' => 'one-one',
47-
'class' => \Media::class
49+
'class' => Media::class
4850
]
4951
];
5052

php-classes/Laddr/ProjectMember.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Laddr;
44

5+
use Emergence\People\Person;
6+
7+
58
class ProjectMember extends \ActiveRecord
69
{
710
// ActiveRecord configuration
@@ -17,18 +20,18 @@ class ProjectMember extends \ActiveRecord
1720
'MemberID' => 'uint',
1821
'Role' => [
1922
'type' => 'string',
20-
'notnull' => false
23+
'default' => null
2124
]
2225
];
2326

2427
public static $relationships = [
2528
'Project' => [
2629
'type' => 'one-one',
27-
'class' => 'Laddr\Project'
30+
'class' => Project::class
2831
],
2932
'Member' => [
3033
'type' => 'one-one',
31-
'class' => 'Person'
34+
'class' => Person::class
3235
]
3336
];
3437

0 commit comments

Comments
 (0)