phpci/PHPCI/Model/Base/UserBase.php

274 lines
4.9 KiB
PHP
Raw Normal View History

2013-05-10 17:25:51 +02:00
<?php
/**
* User base model for table: user
*/
namespace PHPCI\Model\Base;
2013-05-10 17:25:51 +02:00
use b8\Model;
2013-10-10 02:01:06 +02:00
use b8\Store\Factory;
2013-05-10 17:25:51 +02:00
/**
* User Base Model
*/
class UserBase extends Model
{
/**
* @var array
*/
public static $sleepable = array();
/**
* @var string
*/
protected $tableName = 'user';
/**
* @var string
*/
protected $modelName = 'User';
/**
* @var array
*/
protected $data = array(
'id' => null,
'email' => null,
'hash' => null,
'is_admin' => null,
'name' => null,
2013-10-10 02:01:06 +02:00
);
/**
* @var array
*/
protected $getters = array(
2013-10-10 02:01:06 +02:00
// Direct property getters:
'id' => 'getId',
'email' => 'getEmail',
'hash' => 'getHash',
'is_admin' => 'getIsAdmin',
'name' => 'getName',
2013-10-10 02:01:06 +02:00
// Foreign key getters:
);
/**
* @var array
*/
protected $setters = array(
2013-10-10 02:01:06 +02:00
// Direct property setters:
'id' => 'setId',
'email' => 'setEmail',
'hash' => 'setHash',
'is_admin' => 'setIsAdmin',
'name' => 'setName',
2013-10-10 02:01:06 +02:00
// Foreign key setters:
);
/**
* @var array
*/
public $columns = array(
'id' => array(
'type' => 'int',
2013-10-10 02:01:06 +02:00
'length' => 11,
'primary_key' => true,
'auto_increment' => true,
2013-10-08 08:45:20 +02:00
'default' => null,
2013-10-10 02:01:06 +02:00
),
'email' => array(
'type' => 'varchar',
2013-10-10 02:01:06 +02:00
'length' => 250,
),
'hash' => array(
'type' => 'varchar',
2013-10-10 02:01:06 +02:00
'length' => 250,
),
'is_admin' => array(
'type' => 'tinyint',
2013-10-10 02:01:06 +02:00
'length' => 1,
),
'name' => array(
'type' => 'varchar',
2013-10-10 02:01:06 +02:00
'length' => 250,
'nullable' => true,
'default' => null,
2013-10-10 02:01:06 +02:00
),
);
/**
* @var array
*/
public $indexes = array(
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
'idx_email' => array('unique' => true, 'columns' => 'email'),
2013-10-10 02:01:06 +02:00
);
/**
* @var array
*/
public $foreignKeys = array(
2013-10-10 02:01:06 +02:00
);
/**
* Get the value of Id / id.
*
* @return int
*/
public function getId()
{
2013-05-16 16:53:00 +02:00
$rtn = $this->data['id'];
return $rtn;
}
/**
* Get the value of Email / email.
*
* @return string
*/
public function getEmail()
{
2013-05-16 16:53:00 +02:00
$rtn = $this->data['email'];
return $rtn;
}
/**
* Get the value of Hash / hash.
*
* @return string
*/
public function getHash()
{
2013-05-16 16:53:00 +02:00
$rtn = $this->data['hash'];
return $rtn;
}
/**
* Get the value of IsAdmin / is_admin.
*
* @return int
*/
public function getIsAdmin()
{
2013-05-16 16:53:00 +02:00
$rtn = $this->data['is_admin'];
return $rtn;
}
/**
* Get the value of Name / name.
*
* @return string
*/
public function getName()
{
2013-05-16 16:53:00 +02:00
$rtn = $this->data['name'];
return $rtn;
}
/**
* Set the value of Id / id.
*
* Must not be null.
* @param $value int
*/
public function setId($value)
{
$this->_validateNotNull('Id', $value);
$this->_validateInt('Id', $value);
2013-10-10 02:01:06 +02:00
2013-10-08 08:45:20 +02:00
if ($this->data['id'] === $value) {
return;
}
2013-05-16 16:53:00 +02:00
$this->data['id'] = $value;
$this->_setModified('id');
}
/**
* Set the value of Email / email.
*
* Must not be null.
* @param $value string
*/
public function setEmail($value)
{
$this->_validateNotNull('Email', $value);
$this->_validateString('Email', $value);
2013-10-10 02:01:06 +02:00
2013-10-08 08:45:20 +02:00
if ($this->data['email'] === $value) {
return;
}
2013-05-16 16:53:00 +02:00
$this->data['email'] = $value;
$this->_setModified('email');
}
/**
* Set the value of Hash / hash.
*
* Must not be null.
* @param $value string
*/
public function setHash($value)
{
$this->_validateNotNull('Hash', $value);
$this->_validateString('Hash', $value);
2013-10-10 02:01:06 +02:00
2013-10-08 08:45:20 +02:00
if ($this->data['hash'] === $value) {
return;
}
2013-05-16 16:53:00 +02:00
$this->data['hash'] = $value;
$this->_setModified('hash');
}
/**
* Set the value of IsAdmin / is_admin.
*
* Must not be null.
* @param $value int
*/
public function setIsAdmin($value)
{
$this->_validateNotNull('IsAdmin', $value);
$this->_validateInt('IsAdmin', $value);
2013-10-10 02:01:06 +02:00
2013-10-08 08:45:20 +02:00
if ($this->data['is_admin'] === $value) {
return;
}
2013-05-16 16:53:00 +02:00
$this->data['is_admin'] = $value;
$this->_setModified('is_admin');
}
/**
* Set the value of Name / name.
*
* @param $value string
*/
public function setName($value)
{
$this->_validateString('Name', $value);
2013-10-10 02:01:06 +02:00
2013-10-08 08:45:20 +02:00
if ($this->data['name'] === $value) {
return;
}
2013-05-16 16:53:00 +02:00
$this->data['name'] = $value;
$this->_setModified('name');
}
2013-05-10 17:25:51 +02:00
}