diff options
Diffstat (limited to 'classes/Foreign_link.php')
-rw-r--r-- | classes/Foreign_link.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/classes/Foreign_link.php b/classes/Foreign_link.php index 4fcad4b17..f4f8abfc4 100644 --- a/classes/Foreign_link.php +++ b/classes/Foreign_link.php @@ -29,7 +29,6 @@ class Foreign_link extends DB_DataObject // XXX: This only returns a 1->1 single obj mapping. Change? Or make // a getForeignUsers() that returns more than one? --Zach static function getForeignLink($user_id, $service) { - $flink = new Foreign_link(); $flink->whereAdd("service = $service"); $flink->whereAdd("user_id = $user_id"); @@ -43,4 +42,19 @@ class Foreign_link extends DB_DataObject return NULL; } + // Convenience method + function getForeignUser() { + $fuser = new Foreign_user(); + $fuser->whereAdd('service = ' . $this->service); + $fuser->whereAdd('id = ' . $this->foreign_id); + $fuser->limit(1); + + if ($fuser->find()) { + $fuser->fetch(); + return $fuser; + } + + return NULL; + } + } |