We never accept a user without a Profile

This commit is contained in:
Mikael Nordfeldth 2013-10-15 01:00:27 +02:00
parent f46d675a20
commit 1dc051a9eb
1 changed files with 6 additions and 4 deletions

View File

@ -120,16 +120,18 @@ class User extends Managed_DataObject
);
}
protected $_profile = -1;
protected $_profile = null;
/**
* @return Profile
*
* @throws UserNoProfileException if user has no profile
*/
function getProfile()
public function getProfile()
{
if (is_int($this->_profile) && $this->_profile == -1) { // invalid but distinct from null
if (!($this->_profile instanceof Profile)) {
$this->_profile = Profile::getKV('id', $this->id);
if (empty($this->_profile)) {
if (!($this->_profile instanceof Profile)) {
throw new UserNoProfileException($this);
}
}