Add email column to extensible features

refs #5151
This commit is contained in:
Marius Hein 2013-11-28 17:22:53 +01:00
parent 5d31633eb5
commit 263f09a94c
1 changed files with 24 additions and 2 deletions

View File

@ -96,6 +96,13 @@ class DbUserBackend implements UserBackend
*/
private $userColumnName = 'username';
/**
* Column name of email
*
* @var string
*/
private $emailColumnName = null;
/**
* Name of the backend
*
@ -182,6 +189,18 @@ class DbUserBackend implements UserBackend
$this->activeColumnName = $activeColumnName;
}
/**
* Setter for email column
*
* Set to null if not needed
*
* @param string $emailColumnName
*/
public function setEmailColumnName($emailColumnName)
{
$this->emailColumnName = $emailColumnName;
}
/**
* Name of the backend
*
@ -312,10 +331,13 @@ class DbUserBackend implements UserBackend
*
* @return User The created instance of User.
*/
private function createUserFromResult(stdClass $resultRow)
protected function createUserFromResult(stdClass $resultRow)
{
$usr = new User(
$resultRow->{$this->userColumnName}
$resultRow->{$this->userColumnName},
null,
null,
(isset($resultRow->{$this->emailColumnName})) ? $resultRow->{$this->emailColumnName} : null
);
return $usr;
}