aboutsummaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorMikael Nordfeldth <mmn@hethane.se>2016-02-21 18:47:47 +0100
committerMikael Nordfeldth <mmn@hethane.se>2016-02-21 18:47:47 +0100
commitd16a883e17db66a8bb5c647725d319e3c0edb564 (patch)
tree9be45710570c14af375991db5340cbf535ac6a63 /classes
parentb23cc7465f823ee1199ad60cf36357873e5118e2 (diff)
downloadgnu-social-d16a883e17db66a8bb5c647725d319e3c0edb564.tar
gnu-social-d16a883e17db66a8bb5c647725d319e3c0edb564.zip
Allow lookup of User->getByUri (throws NoResultException)
Diffstat (limited to 'classes')
-rw-r--r--classes/User.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/classes/User.php b/classes/User.php
index c232b2b12f..40e1a1b644 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -140,6 +140,16 @@ class User extends Managed_DataObject
return $this->uri;
}
+ static function getByUri($uri)
+ {
+ $user = new User();
+ $user->uri = $uri;
+ if (!$user->find(true)) {
+ throw new NoResultException($user);
+ }
+ return $user;
+ }
+
public function getNickname()
{
return $this->getProfile()->getNickname();