Allow lookup of User->getByUri (throws NoResultException)

This commit is contained in:
Mikael Nordfeldth 2016-02-21 18:47:47 +01:00
parent b23cc7465f
commit d16a883e17
1 changed files with 10 additions and 0 deletions

View 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();