From d16a883e17db66a8bb5c647725d319e3c0edb564 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sun, 21 Feb 2016 18:47:47 +0100 Subject: [PATCH] Allow lookup of User->getByUri (throws NoResultException) --- classes/User.php | 10 ++++++++++ 1 file changed, 10 insertions(+) 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(); -- 2.39.5