Simplify functions regarding locally cached profiles etc.

This commit is contained in:
Mikael Nordfeldth
2014-06-06 00:32:07 +02:00
parent c786892103
commit c8c6bf9a1c
3 changed files with 20 additions and 36 deletions

View File

@@ -123,19 +123,15 @@ class User extends Managed_DataObject
public function getProfile()
{
if (!isset($this->_profile[$this->id])) {
$this->_setProfile(Profile::getKV('id', $this->id));
$profile = Profile::getKV('id', $this->id);
if (!$profile instanceof Profile) {
throw new UserNoProfileException($this);
}
$this->_profile[$this->id] = $profile;
}
return $this->_profile[$this->id];
}
public function _setProfile(Profile $profile=null)
{
if (!$profile instanceof Profile) {
throw new UserNoProfileException($this);
}
$this->_profile[$this->id] = $profile;
}
public function getUri()
{
return $this->uri;