mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-07 15:36:34 +02:00
Added docblocs to User entity
This commit is contained in:
@@ -5,15 +5,33 @@ namespace DesignPatterns\DataMapper;
|
|||||||
/**
|
/**
|
||||||
* DataMapper pattern
|
* DataMapper pattern
|
||||||
*
|
*
|
||||||
* This is our representation of a DataBase record in the memory
|
* This is our representation of a DataBase record in the memory (Entity)
|
||||||
|
*
|
||||||
|
* Validation would also go in this object
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class User
|
class User
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
protected $userId;
|
protected $userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $username;
|
protected $username;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
protected $email;
|
protected $email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param null $id
|
||||||
|
* @param null $username
|
||||||
|
* @param null $email
|
||||||
|
*/
|
||||||
public function __construct($id = null, $username = null, $email = null)
|
public function __construct($id = null, $username = null, $email = null)
|
||||||
{
|
{
|
||||||
$this->userId = $id;
|
$this->userId = $id;
|
||||||
@@ -21,26 +39,44 @@ class User
|
|||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
public function getUserId() {
|
public function getUserId() {
|
||||||
return $this->userId;
|
return $this->userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $userId
|
||||||
|
*/
|
||||||
public function setUserID($userId) {
|
public function setUserID($userId) {
|
||||||
$this->userId = $userId;
|
$this->userId = $userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getUsername() {
|
public function getUsername() {
|
||||||
return $this->username;
|
return $this->username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $username
|
||||||
|
*/
|
||||||
public function setUsername($username) {
|
public function setUsername($username) {
|
||||||
$this->username = $username;
|
$this->username = $username;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getEmail() {
|
public function getEmail() {
|
||||||
return $this->email;
|
return $this->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $email
|
||||||
|
*/
|
||||||
public function setEmail($email) {
|
public function setEmail($email) {
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user