]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Allow lookup of User->getByUri (throws NoResultException)
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 21 Feb 2016 17:47:47 +0000 (18:47 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 21 Feb 2016 17:47:47 +0000 (18:47 +0100)
classes/User.php

index c232b2b12f307c8c2ee2e0d60cc069a3746612f4..40e1a1b6443a2503371e1e81c680ea73d26cce58 100644 (file)
@@ -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();