Permalink
Browse files

Update class syntax

  • Loading branch information...
themightychris committed Nov 7, 2017
1 parent 86b6815 commit 749aa7e024b39bd0ea8fab5bdbd11e6ef1238c88
@@ -2,6 +2,9 @@
namespace Laddr;
use Emergence\People\Person;
class MemberCheckin extends \ActiveRecord
{
// ActiveRecord configuration
@@ -16,18 +19,18 @@ class MemberCheckin extends \ActiveRecord
'MemberID' => 'uint',
'ProjectID' => [
'type' => 'uint',
'notnull' => false
'default' => null
],
'MeetupID' => [
'type' => 'string',
'notnull' => false
'default' => null
]
];
public static $relationships = [
'Member' => [
'type' => 'one-one',
'class' => \Emergence\People\Person::class
'class' => \Person::class
],
'Project' => [
'type' => 'one-one',
@@ -2,7 +2,13 @@
namespace Laddr;
use DB;
use HandleBehavior;
use Tag, TagItem;
use Comment;
use Emergence\People\Person;
use Emergence\People\IPerson;
class Project extends \VersionedRecord
{
@@ -28,19 +34,19 @@ class Project extends \VersionedRecord
],
'MaintainerID' => [
'type' => 'uint',
'notnull' => false
'default' => null
],
'UsersUrl' => [
'type' => 'string',
'notnull' => false
'default' => null
],
'DevelopersUrl' => [
'type' => 'string',
'notnull' => false
'default' => null
],
'README' => [
'type' => 'clob',
'notnull' => false
'default' => null
],
'NextUpdate' => [
'type' => 'uint',
@@ -68,11 +74,11 @@ class Project extends \VersionedRecord
public static $relationships = [
'Maintainer' => [
'type' => 'one-one',
'class' => \Emergence\People\Person::class
'class' => Person::class
],
'Members' => [
'type' => 'many-many',
'class' => \Emergence\People\Person::class,
'class' => Person::class,
'linkClass' => ProjectMember::class,
'linkLocal' => 'ProjectID',
'linkForeign' => 'MemberID',
@@ -91,20 +97,20 @@ class Project extends \VersionedRecord
],
'Comments' => [
'type' => 'context-children',
'class' => \Comment::class,
'class' => Comment::class,
'order' => ['ID' => 'DESC']
],
'Tags' => [
'type' => 'many-many',
'class' => \Tag::class,
'linkClass' => \TagItem::class,
'class' => Tag::class,
'linkClass' => TagItem::class,
'linkLocal' => 'ContextID',
'conditions' => ['Link.ContextClass = "Laddr\\\\Project"']
],
'TopicTags' => [
'type' => 'many-many',
'class' => \Tag::class,
'linkClass' => \TagItem::class,
'class' => Tag::class,
'linkClass' => TagItem::class,
'linkLocal' => 'ContextID',
'conditions' => [
'Link.ContextClass = "Laddr\\\\Project"',
@@ -113,8 +119,8 @@ class Project extends \VersionedRecord
],
'TechTags' => [
'type' => 'many-many',
'class' => \Tag::class,
'linkClass' => \TagItem::class,
'class' => Tag::class,
'linkClass' => TagItem::class,
'linkLocal' => 'ContextID',
'conditions' => [
'Link.ContextClass = "Laddr\\\\Project"',
@@ -123,8 +129,8 @@ class Project extends \VersionedRecord
],
'EventTags' => [
'type' => 'many-many',
'class' => \Tag::class,
'linkClass' => \TagItem::class,
'class' => Tag::class,
'linkClass' => TagItem::class,
'linkLocal' => 'ContextID',
'conditions' => [
'Link.ContextClass = "Laddr\\\\Project"',
@@ -194,7 +200,7 @@ public function save($deep = true)
}
}
public function hasMember(\Emergence\People\IPerson $Person)
public function hasMember(IPerson $Person)
{
foreach ($this->Members AS $Member) {
if ($Member->ID == $Person->ID) {
@@ -211,28 +217,28 @@ public function getActivity($limit = null)
// retrieve updates and buzz metadata from database
try {
$updates = \DB::allRecords(
$updates = DB::allRecords(
'SELECT ID, Class, UNIX_TIMESTAMP(Created) AS Timestamp FROM `%s` WHERE ProjectID = %u ORDER BY Timestamp DESC %s',
[
ProjectUpdate::$tableName,
$this->ID,
$limitSql
]
);
} catch (\TableNotFoundException $e) {
} catch (TableNotFoundException $e) {
$updates = [];
}
try {
$buzz = \DB::allRecords(
$buzz = DB::allRecords(
'SELECT ID, Class, UNIX_TIMESTAMP(Published) AS Timestamp FROM `%s` WHERE ProjectID = %u ORDER BY Timestamp DESC %s',
[
ProjectBuzz::$tableName,
$this->ID,
$limitSql
]
);
} catch (\TableNotFoundException $e) {
} catch (TableNotFoundException $e) {
$buzz = [];
}
@@ -262,13 +268,13 @@ function($result) {
public static function getStagesSummary()
{
try {
$stages = \DB::allRecords(
$stages = DB::allRecords(
'SELECT Stage, COUNT(*) AS itemsCount FROM `%s` GROUP BY Stage ORDER BY itemsCount DESC',
[
static::$tableName
]
);
} catch (\TableNotFoundException $e) {
} catch (TableNotFoundException $e) {
$stages = [];
}
@@ -3,6 +3,8 @@
namespace Laddr;
use HandleBehavior;
use Media;
class ProjectBuzz extends \ActiveRecord
{
@@ -29,11 +31,11 @@ class ProjectBuzz extends \ActiveRecord
'Published' => 'timestamp',
'ImageID' => [
'type' => 'uint',
'notnull' => false
'default' => null
],
'Summary' => [
'type' => 'clob',
'notnull' => false
'default' => null
]
];
@@ -44,7 +46,7 @@ class ProjectBuzz extends \ActiveRecord
],
'Image' => [
'type' => 'one-one',
'class' => \Media::class
'class' => Media::class
]
];
@@ -2,6 +2,9 @@
namespace Laddr;
use Emergence\People\Person;
class ProjectMember extends \ActiveRecord
{
// ActiveRecord configuration
@@ -17,18 +20,18 @@ class ProjectMember extends \ActiveRecord
'MemberID' => 'uint',
'Role' => [
'type' => 'string',
'notnull' => false
'default' => null
]
];
public static $relationships = [
'Project' => [
'type' => 'one-one',
'class' => 'Laddr\Project'
'class' => Project::class
],
'Member' => [
'type' => 'one-one',
'class' => 'Person'
'class' => Person::class
]
];

0 comments on commit 749aa7e

Please sign in to comment.