Making the public key a property that we store for projects, and displaying it for later use.
This commit is contained in:
parent
616d52e025
commit
195d85a82c
9 changed files with 816 additions and 655 deletions
|
|
@ -15,168 +15,173 @@ use b8\Store\Factory;
|
|||
class UserBase extends Model
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
* @var array
|
||||
*/
|
||||
public static $sleepable = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'user';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = 'User';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array(
|
||||
|
||||
'id' => null,
|
||||
'email' => null,
|
||||
'hash' => null,
|
||||
'id' => null,
|
||||
'email' => null,
|
||||
'hash' => null,
|
||||
'is_admin' => null,
|
||||
'name' => null,
|
||||
|
||||
'name' => null,
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = array(
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'email' => 'getEmail',
|
||||
'hash' => 'getHash',
|
||||
'id' => 'getId',
|
||||
'email' => 'getEmail',
|
||||
'hash' => 'getHash',
|
||||
'is_admin' => 'getIsAdmin',
|
||||
'name' => 'getName',
|
||||
'name' => 'getName',
|
||||
|
||||
// Foreign key getters:
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = array(
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'email' => 'setEmail',
|
||||
'hash' => 'setHash',
|
||||
'id' => 'setId',
|
||||
'email' => 'setEmail',
|
||||
'hash' => 'setHash',
|
||||
'is_admin' => 'setIsAdmin',
|
||||
'name' => 'setName',
|
||||
'name' => 'setName',
|
||||
|
||||
// Foreign key setters:
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
* @var array
|
||||
*/
|
||||
public $columns = array(
|
||||
'id' => array(
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'id' => array(
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
),
|
||||
'email' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'hash' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'email' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'hash' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'is_admin' => array(
|
||||
'type' => 'tinyint',
|
||||
'length' => 1,
|
||||
'type' => 'tinyint',
|
||||
'length' => 1,
|
||||
'default' => null,
|
||||
),
|
||||
'name' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'name' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
'default' => null,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = array(
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
'idx_email' => array('unique' => true, 'columns' => 'email'),
|
||||
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
|
||||
'idx_email' => array('unique' => true, 'columns' => 'email'),
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = array();
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$rtn = $this->data['id'];
|
||||
$rtn = $this->data['id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Email / email.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
* Get the value of Email / email.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
$rtn = $this->data['email'];
|
||||
$rtn = $this->data['email'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Hash / hash.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
* Get the value of Hash / hash.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHash()
|
||||
{
|
||||
$rtn = $this->data['hash'];
|
||||
$rtn = $this->data['hash'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of IsAdmin / is_admin.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
* Get the value of IsAdmin / is_admin.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIsAdmin()
|
||||
{
|
||||
$rtn = $this->data['is_admin'];
|
||||
$rtn = $this->data['is_admin'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Name / name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
* Get the value of Name / name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
$rtn = $this->data['name'];
|
||||
$rtn = $this->data['name'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
* Must not be null.
|
||||
*
|
||||
* @param $value int
|
||||
*/
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->_validateNotNull('Id', $value);
|
||||
|
|
@ -185,17 +190,18 @@ class UserBase extends Model
|
|||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['id'] = $value;
|
||||
|
||||
$this->_setModified('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Email / email.
|
||||
*
|
||||
* Must not be null.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
* Set the value of Email / email.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setEmail($value)
|
||||
{
|
||||
$this->_validateNotNull('Email', $value);
|
||||
|
|
@ -204,17 +210,18 @@ class UserBase extends Model
|
|||
if ($this->data['email'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['email'] = $value;
|
||||
|
||||
$this->_setModified('email');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Hash / hash.
|
||||
*
|
||||
* Must not be null.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
* Set the value of Hash / hash.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setHash($value)
|
||||
{
|
||||
$this->_validateNotNull('Hash', $value);
|
||||
|
|
@ -223,17 +230,18 @@ class UserBase extends Model
|
|||
if ($this->data['hash'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['hash'] = $value;
|
||||
|
||||
$this->_setModified('hash');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of IsAdmin / is_admin.
|
||||
*
|
||||
* Must not be null.
|
||||
*
|
||||
* @param $value int
|
||||
*/
|
||||
* Set the value of IsAdmin / is_admin.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setIsAdmin($value)
|
||||
{
|
||||
$this->_validateNotNull('IsAdmin', $value);
|
||||
|
|
@ -242,15 +250,17 @@ class UserBase extends Model
|
|||
if ($this->data['is_admin'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['is_admin'] = $value;
|
||||
|
||||
$this->_setModified('is_admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Name / name.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
* Set the value of Name / name.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
$this->_validateString('Name', $value);
|
||||
|
|
@ -258,15 +268,21 @@ class UserBase extends Model
|
|||
if ($this->data['name'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['name'] = $value;
|
||||
|
||||
$this->_setModified('name');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getByPrimaryKey($value, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('User', 'PHPCI')->getByPrimaryKey($value, $useConnection);
|
||||
}
|
||||
|
||||
|
||||
public static function getById($value, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('User', 'PHPCI')->getById($value, $useConnection);
|
||||
|
|
@ -276,4 +292,7 @@ class UserBase extends Model
|
|||
{
|
||||
return Factory::getStore('User', 'PHPCI')->getByEmail($value, $useConnection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue