From: Mikael Nordfeldth Date: Sun, 21 Feb 2016 17:47:47 +0000 (+0100) Subject: Allow lookup of User->getByUri (throws NoResultException) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d16a883e17db66a8bb5c647725d319e3c0edb564;p=quix0rs-gnu-social.git Allow lookup of User->getByUri (throws NoResultException) --- 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();