]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User.php
Allow lookup of User->getByUri (throws NoResultException)
[quix0rs-gnu-social.git] / 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();