Fixed namespaces (PHPCI -> PHPCensor)
This commit is contained in:
parent
60d74b0b44
commit
60a2b7282a
238 changed files with 1014 additions and 863 deletions
648
src/PHPCensor/Model/Base/BuildBase.php
Normal file
648
src/PHPCensor/Model/Base/BuildBase.php
Normal file
|
|
@ -0,0 +1,648 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Build base model for table: build
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
use b8\Store\Factory;
|
||||
use PHPCensor\Model\Project;
|
||||
|
||||
/**
|
||||
* Build Base Model
|
||||
*/
|
||||
class BuildBase extends Model
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $sleepable = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'build';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = 'Build';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'project_id' => null,
|
||||
'commit_id' => null,
|
||||
'status' => null,
|
||||
'log' => null,
|
||||
'branch' => null,
|
||||
'created' => null,
|
||||
'started' => null,
|
||||
'finished' => null,
|
||||
'committer_email' => null,
|
||||
'commit_message' => null,
|
||||
'extra' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = [
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'project_id' => 'getProjectId',
|
||||
'commit_id' => 'getCommitId',
|
||||
'status' => 'getStatus',
|
||||
'log' => 'getLog',
|
||||
'branch' => 'getBranch',
|
||||
'created' => 'getCreated',
|
||||
'started' => 'getStarted',
|
||||
'finished' => 'getFinished',
|
||||
'committer_email' => 'getCommitterEmail',
|
||||
'commit_message' => 'getCommitMessage',
|
||||
'extra' => 'getExtra',
|
||||
|
||||
// Foreign key getters:
|
||||
'Project' => 'getProject',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = [
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'project_id' => 'setProjectId',
|
||||
'commit_id' => 'setCommitId',
|
||||
'status' => 'setStatus',
|
||||
'log' => 'setLog',
|
||||
'branch' => 'setBranch',
|
||||
'created' => 'setCreated',
|
||||
'started' => 'setStarted',
|
||||
'finished' => 'setFinished',
|
||||
'committer_email' => 'setCommitterEmail',
|
||||
'commit_message' => 'setCommitMessage',
|
||||
'extra' => 'setExtra',
|
||||
|
||||
// Foreign key setters:
|
||||
'Project' => 'setProject',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = [
|
||||
'id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'project_id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'default' => null,
|
||||
],
|
||||
'commit_id' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'default' => null,
|
||||
],
|
||||
'status' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'default' => null,
|
||||
],
|
||||
'log' => [
|
||||
'type' => 'mediumtext',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'branch' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => 'master',
|
||||
],
|
||||
'created' => [
|
||||
'type' => 'datetime',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'started' => [
|
||||
'type' => 'datetime',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'finished' => [
|
||||
'type' => 'datetime',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'committer_email' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 512,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'commit_message' => [
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'extra' => [
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
'project_id' => ['columns' => 'project_id'],
|
||||
'idx_status' => ['columns' => 'status'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = [
|
||||
'build_ibfk_1' => [
|
||||
'local_col' => 'project_id',
|
||||
'update' => 'CASCADE',
|
||||
'delete' => 'CASCADE',
|
||||
'table' => 'project',
|
||||
'col' => 'id'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$rtn = $this->data['id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of ProjectId / project_id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getProjectId()
|
||||
{
|
||||
$rtn = $this->data['project_id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of CommitId / commit_id.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitId()
|
||||
{
|
||||
$rtn = $this->data['commit_id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Status / status.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
$rtn = $this->data['status'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Log / log.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLog()
|
||||
{
|
||||
$rtn = $this->data['log'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Branch / branch.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBranch()
|
||||
{
|
||||
$rtn = $this->data['branch'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Created / created.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getCreated()
|
||||
{
|
||||
$rtn = $this->data['created'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Started / started.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getStarted()
|
||||
{
|
||||
$rtn = $this->data['started'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Finished / finished.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getFinished()
|
||||
{
|
||||
$rtn = $this->data['finished'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of CommitterEmail / committer_email.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitterEmail()
|
||||
{
|
||||
$rtn = $this->data['committer_email'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of CommitMessage / commit_message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitMessage()
|
||||
{
|
||||
$rtn = $this->data['commit_message'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Extra / extra.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExtra()
|
||||
{
|
||||
$rtn = $this->data['extra'];
|
||||
|
||||
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);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['id'] = $value;
|
||||
|
||||
$this->_setModified('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of ProjectId / project_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setProjectId($value)
|
||||
{
|
||||
$this->_validateNotNull('ProjectId', $value);
|
||||
$this->_validateInt('ProjectId', $value);
|
||||
|
||||
if ($this->data['project_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['project_id'] = $value;
|
||||
|
||||
$this->_setModified('project_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of CommitId / commit_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setCommitId($value)
|
||||
{
|
||||
$this->_validateNotNull('CommitId', $value);
|
||||
$this->_validateString('CommitId', $value);
|
||||
|
||||
if ($this->data['commit_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['commit_id'] = $value;
|
||||
|
||||
$this->_setModified('commit_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Status / status.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setStatus($value)
|
||||
{
|
||||
$this->_validateNotNull('Status', $value);
|
||||
$this->_validateInt('Status', $value);
|
||||
|
||||
if ($this->data['status'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['status'] = $value;
|
||||
|
||||
$this->_setModified('status');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Log / log.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setLog($value)
|
||||
{
|
||||
$this->_validateString('Log', $value);
|
||||
|
||||
if ($this->data['log'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['log'] = $value;
|
||||
|
||||
$this->_setModified('log');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Branch / branch.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setBranch($value)
|
||||
{
|
||||
$this->_validateNotNull('Branch', $value);
|
||||
$this->_validateString('Branch', $value);
|
||||
|
||||
if ($this->data['branch'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['branch'] = $value;
|
||||
|
||||
$this->_setModified('branch');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Created / created.
|
||||
*
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setCreated($value)
|
||||
{
|
||||
$this->_validateDate('Created', $value);
|
||||
|
||||
if ($this->data['created'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['created'] = $value;
|
||||
|
||||
$this->_setModified('created');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Started / started.
|
||||
*
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setStarted($value)
|
||||
{
|
||||
$this->_validateDate('Started', $value);
|
||||
|
||||
if ($this->data['started'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['started'] = $value;
|
||||
|
||||
$this->_setModified('started');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Finished / finished.
|
||||
*
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setFinished($value)
|
||||
{
|
||||
$this->_validateDate('Finished', $value);
|
||||
|
||||
if ($this->data['finished'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['finished'] = $value;
|
||||
|
||||
$this->_setModified('finished');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of CommitterEmail / committer_email.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setCommitterEmail($value)
|
||||
{
|
||||
$this->_validateString('CommitterEmail', $value);
|
||||
|
||||
if ($this->data['committer_email'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['committer_email'] = $value;
|
||||
|
||||
$this->_setModified('committer_email');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of CommitMessage / commit_message.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setCommitMessage($value)
|
||||
{
|
||||
$this->_validateString('CommitMessage', $value);
|
||||
|
||||
if ($this->data['commit_message'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['commit_message'] = $value;
|
||||
|
||||
$this->_setModified('commit_message');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Extra / extra.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setExtra($value)
|
||||
{
|
||||
$this->_validateString('Extra', $value);
|
||||
|
||||
if ($this->data['extra'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['extra'] = $value;
|
||||
|
||||
$this->_setModified('extra');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Project model for this Build by Id.
|
||||
*
|
||||
* @uses \PHPCI\Store\ProjectStore::getById()
|
||||
* @uses \PHPCI\Model\Project
|
||||
* @return \PHPCI\Model\Project
|
||||
*/
|
||||
public function getProject()
|
||||
{
|
||||
$key = $this->getProjectId();
|
||||
|
||||
if (empty($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$cacheKey = 'Cache.Project.' . $key;
|
||||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
$rtn = Factory::getStore('Project', 'PHPCensor')->getById($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Project - Accepts an ID, an array representing a Project or a Project model.
|
||||
*
|
||||
* @param $value mixed
|
||||
*/
|
||||
public function setProject($value)
|
||||
{
|
||||
// Is this an instance of Project?
|
||||
if ($value instanceof Project) {
|
||||
return $this->setProjectObject($value);
|
||||
}
|
||||
|
||||
// Is this an array representing a Project item?
|
||||
if (is_array($value) && !empty($value['id'])) {
|
||||
return $this->setProjectId($value['id']);
|
||||
}
|
||||
|
||||
// Is this a scalar value representing the ID of this foreign key?
|
||||
return $this->setProjectId($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Project - Accepts a Project model.
|
||||
*
|
||||
* @param $value Project
|
||||
*/
|
||||
public function setProjectObject(Project $value)
|
||||
{
|
||||
return $this->setProjectId($value->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get BuildError models by BuildId for this Build.
|
||||
*
|
||||
* @uses \PHPCensor\Store\BuildErrorStore::getByBuildId()
|
||||
* @uses \PHPCensor\Model\BuildError
|
||||
* @return \PHPCensor\Model\BuildError[]
|
||||
*/
|
||||
public function getBuildBuildErrors()
|
||||
{
|
||||
return Factory::getStore('BuildError', 'PHPCensor')->getByBuildId($this->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get BuildMeta models by BuildId for this Build.
|
||||
*
|
||||
* @uses \PHPCensor\Store\BuildMetaStore::getByBuildId()
|
||||
* @uses \PHPCensor\Model\BuildMeta
|
||||
* @return \PHPCensor\Model\BuildMeta[]
|
||||
*/
|
||||
public function getBuildBuildMetas()
|
||||
{
|
||||
return Factory::getStore('BuildMeta', 'PHPCensor')->getByBuildId($this->getId());
|
||||
}
|
||||
}
|
||||
504
src/PHPCensor/Model/Base/BuildErrorBase.php
Normal file
504
src/PHPCensor/Model/Base/BuildErrorBase.php
Normal file
|
|
@ -0,0 +1,504 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* BuildError base model for table: build_error
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
use b8\Store\Factory;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* BuildError Base Model
|
||||
*/
|
||||
class BuildErrorBase extends Model
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $sleepable = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'build_error';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = 'BuildError';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'build_id' => null,
|
||||
'plugin' => null,
|
||||
'file' => null,
|
||||
'line_start' => null,
|
||||
'line_end' => null,
|
||||
'severity' => null,
|
||||
'message' => null,
|
||||
'created_date' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = [
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'build_id' => 'getBuildId',
|
||||
'plugin' => 'getPlugin',
|
||||
'file' => 'getFile',
|
||||
'line_start' => 'getLineStart',
|
||||
'line_end' => 'getLineEnd',
|
||||
'severity' => 'getSeverity',
|
||||
'message' => 'getMessage',
|
||||
'created_date' => 'getCreatedDate',
|
||||
|
||||
// Foreign key getters:
|
||||
'Build' => 'getBuild',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = [
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'build_id' => 'setBuildId',
|
||||
'plugin' => 'setPlugin',
|
||||
'file' => 'setFile',
|
||||
'line_start' => 'setLineStart',
|
||||
'line_end' => 'setLineEnd',
|
||||
'severity' => 'setSeverity',
|
||||
'message' => 'setMessage',
|
||||
'created_date' => 'setCreatedDate',
|
||||
|
||||
// Foreign key setters:
|
||||
'Build' => 'setBuild',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = [
|
||||
'id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'build_id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'default' => null,
|
||||
],
|
||||
'plugin' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'default' => null,
|
||||
],
|
||||
'file' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'line_start' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'line_end' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'severity' => [
|
||||
'type' => 'tinyint',
|
||||
'length' => 3,
|
||||
'default' => null,
|
||||
],
|
||||
'message' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
],
|
||||
'created_date' => [
|
||||
'type' => 'datetime',
|
||||
'default' => null,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
'build_id' => ['columns' => 'build_id, created_date'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = [
|
||||
'build_error_ibfk_1' => [
|
||||
'local_col' => 'build_id',
|
||||
'update' => 'CASCADE',
|
||||
'delete' => 'CASCADE',
|
||||
'table' => 'build',
|
||||
'col' => 'id'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$rtn = $this->data['id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of BuildId / build_id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBuildId()
|
||||
{
|
||||
$rtn = $this->data['build_id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Plugin / plugin.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPlugin()
|
||||
{
|
||||
$rtn = $this->data['plugin'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of File / file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFile()
|
||||
{
|
||||
$rtn = $this->data['file'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of LineStart / line_start.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLineStart()
|
||||
{
|
||||
$rtn = $this->data['line_start'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of LineEnd / line_end.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLineEnd()
|
||||
{
|
||||
$rtn = $this->data['line_end'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Severity / severity.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSeverity()
|
||||
{
|
||||
$rtn = $this->data['severity'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Message / message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
$rtn = $this->data['message'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of CreatedDate / created_date.
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getCreatedDate()
|
||||
{
|
||||
$rtn = $this->data['created_date'];
|
||||
|
||||
if (!empty($rtn)) {
|
||||
$rtn = new \DateTime($rtn);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['id'] = $value;
|
||||
|
||||
$this->_setModified('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of BuildId / build_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setBuildId($value)
|
||||
{
|
||||
$this->_validateNotNull('BuildId', $value);
|
||||
$this->_validateInt('BuildId', $value);
|
||||
|
||||
if ($this->data['build_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['build_id'] = $value;
|
||||
|
||||
$this->_setModified('build_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Plugin / plugin.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setPlugin($value)
|
||||
{
|
||||
$this->_validateNotNull('Plugin', $value);
|
||||
$this->_validateString('Plugin', $value);
|
||||
|
||||
if ($this->data['plugin'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['plugin'] = $value;
|
||||
|
||||
$this->_setModified('plugin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of File / file.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setFile($value)
|
||||
{
|
||||
$this->_validateString('File', $value);
|
||||
|
||||
if ($this->data['file'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['file'] = $value;
|
||||
|
||||
$this->_setModified('file');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of LineStart / line_start.
|
||||
*
|
||||
* @param $value int
|
||||
*/
|
||||
public function setLineStart($value)
|
||||
{
|
||||
$this->_validateInt('LineStart', $value);
|
||||
|
||||
if ($this->data['line_start'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['line_start'] = $value;
|
||||
|
||||
$this->_setModified('line_start');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of LineEnd / line_end.
|
||||
*
|
||||
* @param $value int
|
||||
*/
|
||||
public function setLineEnd($value)
|
||||
{
|
||||
$this->_validateInt('LineEnd', $value);
|
||||
|
||||
if ($this->data['line_end'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['line_end'] = $value;
|
||||
|
||||
$this->_setModified('line_end');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Severity / severity.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setSeverity($value)
|
||||
{
|
||||
$this->_validateNotNull('Severity', $value);
|
||||
$this->_validateInt('Severity', $value);
|
||||
|
||||
if ($this->data['severity'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['severity'] = $value;
|
||||
|
||||
$this->_setModified('severity');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Message / message.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setMessage($value)
|
||||
{
|
||||
$this->_validateNotNull('Message', $value);
|
||||
$this->_validateString('Message', $value);
|
||||
|
||||
if ($this->data['message'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['message'] = $value;
|
||||
|
||||
$this->_setModified('message');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of CreatedDate / created_date.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value \DateTime
|
||||
*/
|
||||
public function setCreatedDate($value)
|
||||
{
|
||||
$this->_validateNotNull('CreatedDate', $value);
|
||||
$this->_validateDate('CreatedDate', $value);
|
||||
|
||||
if ($this->data['created_date'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['created_date'] = $value;
|
||||
|
||||
$this->_setModified('created_date');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Build model for this BuildError by Id.
|
||||
*
|
||||
* @uses \PHPCI\Store\BuildStore::getById()
|
||||
* @uses \PHPCI\Model\Build
|
||||
* @return \PHPCI\Model\Build
|
||||
*/
|
||||
public function getBuild()
|
||||
{
|
||||
$key = $this->getBuildId();
|
||||
|
||||
if (empty($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$cacheKey = 'Cache.Build.' . $key;
|
||||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
$rtn = Factory::getStore('Build', 'PHPCensor')->getById($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Build - Accepts an ID, an array representing a Build or a Build model.
|
||||
*
|
||||
* @param $value mixed
|
||||
*/
|
||||
public function setBuild($value)
|
||||
{
|
||||
// Is this an instance of Build?
|
||||
if ($value instanceof Build) {
|
||||
return $this->setBuildObject($value);
|
||||
}
|
||||
|
||||
// Is this an array representing a Build item?
|
||||
if (is_array($value) && !empty($value['id'])) {
|
||||
return $this->setBuildId($value['id']);
|
||||
}
|
||||
|
||||
// Is this a scalar value representing the ID of this foreign key?
|
||||
return $this->setBuildId($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Build - Accepts a Build model.
|
||||
*
|
||||
* @param $value Build
|
||||
*/
|
||||
public function setBuildObject(Build $value)
|
||||
{
|
||||
return $this->setBuildId($value->getId());
|
||||
}
|
||||
}
|
||||
409
src/PHPCensor/Model/Base/BuildMetaBase.php
Normal file
409
src/PHPCensor/Model/Base/BuildMetaBase.php
Normal file
|
|
@ -0,0 +1,409 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* BuildMeta base model for table: build_meta
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
use b8\Store\Factory;
|
||||
use PHPCensor\Model\Project;
|
||||
use PHPCensor\Model\Build;
|
||||
|
||||
/**
|
||||
* BuildMeta Base Model
|
||||
*/
|
||||
class BuildMetaBase extends Model
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $sleepable = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'build_meta';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = 'BuildMeta';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'project_id' => null,
|
||||
'build_id' => null,
|
||||
'meta_key' => null,
|
||||
'meta_value' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = [
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'project_id' => 'getProjectId',
|
||||
'build_id' => 'getBuildId',
|
||||
'meta_key' => 'getMetaKey',
|
||||
'meta_value' => 'getMetaValue',
|
||||
// Foreign key getters:
|
||||
'Project' => 'getProject',
|
||||
'Build' => 'getBuild',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = [
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'project_id' => 'setProjectId',
|
||||
'build_id' => 'setBuildId',
|
||||
'meta_key' => 'setMetaKey',
|
||||
'meta_value' => 'setMetaValue',
|
||||
// Foreign key setters:
|
||||
'Project' => 'setProject',
|
||||
'Build' => 'setBuild',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = [
|
||||
'id' => [
|
||||
'type' => 'int',
|
||||
'length' => 10,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'project_id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'default' => null,
|
||||
],
|
||||
'build_id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'default' => null,
|
||||
],
|
||||
'meta_key' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
],
|
||||
'meta_value' => [
|
||||
'type' => 'mediumtext',
|
||||
'default' => null,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
'idx_meta_id' => ['unique' => true, 'columns' => 'build_id, meta_key'],
|
||||
'project_id' => ['columns' => 'project_id'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = [
|
||||
'build_meta_ibfk_1' => [
|
||||
'local_col' => 'project_id',
|
||||
'update' => 'CASCADE',
|
||||
'delete' => 'CASCADE',
|
||||
'table' => 'project',
|
||||
'col' => 'id'
|
||||
],
|
||||
'fk_meta_build_id' => [
|
||||
'local_col' => 'build_id',
|
||||
'update' => 'CASCADE',
|
||||
'delete' => 'CASCADE',
|
||||
'table' => 'build',
|
||||
'col' => 'id'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$rtn = $this->data['id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of ProjectId / project_id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getProjectId()
|
||||
{
|
||||
$rtn = $this->data['project_id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of BuildId / build_id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getBuildId()
|
||||
{
|
||||
$rtn = $this->data['build_id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of MetaKey / meta_key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMetaKey()
|
||||
{
|
||||
$rtn = $this->data['meta_key'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of MetaValue / meta_value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMetaValue()
|
||||
{
|
||||
$rtn = $this->data['meta_value'];
|
||||
|
||||
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);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['id'] = $value;
|
||||
|
||||
$this->_setModified('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of ProjectId / project_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setProjectId($value)
|
||||
{
|
||||
$this->_validateNotNull('ProjectId', $value);
|
||||
$this->_validateInt('ProjectId', $value);
|
||||
|
||||
if ($this->data['project_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['project_id'] = $value;
|
||||
|
||||
$this->_setModified('project_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of BuildId / build_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setBuildId($value)
|
||||
{
|
||||
$this->_validateNotNull('BuildId', $value);
|
||||
$this->_validateInt('BuildId', $value);
|
||||
|
||||
if ($this->data['build_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['build_id'] = $value;
|
||||
|
||||
$this->_setModified('build_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of MetaKey / meta_key.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setMetaKey($value)
|
||||
{
|
||||
$this->_validateNotNull('MetaKey', $value);
|
||||
$this->_validateString('MetaKey', $value);
|
||||
|
||||
if ($this->data['meta_key'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['meta_key'] = $value;
|
||||
|
||||
$this->_setModified('meta_key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of MetaValue / meta_value.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setMetaValue($value)
|
||||
{
|
||||
$this->_validateNotNull('MetaValue', $value);
|
||||
$this->_validateString('MetaValue', $value);
|
||||
|
||||
if ($this->data['meta_value'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['meta_value'] = $value;
|
||||
|
||||
$this->_setModified('meta_value');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Project model for this BuildMeta by Id.
|
||||
*
|
||||
* @uses \PHPCI\Store\ProjectStore::getById()
|
||||
* @uses \PHPCI\Model\Project
|
||||
* @return \PHPCI\Model\Project
|
||||
*/
|
||||
public function getProject()
|
||||
{
|
||||
$key = $this->getProjectId();
|
||||
|
||||
if (empty($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$cacheKey = 'Cache.Project.' . $key;
|
||||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
$rtn = Factory::getStore('Project', 'PHPCensor')->getById($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Project - Accepts an ID, an array representing a Project or a Project model.
|
||||
*
|
||||
* @param $value mixed
|
||||
*/
|
||||
public function setProject($value)
|
||||
{
|
||||
// Is this an instance of Project?
|
||||
if ($value instanceof Project) {
|
||||
return $this->setProjectObject($value);
|
||||
}
|
||||
|
||||
// Is this an array representing a Project item?
|
||||
if (is_array($value) && !empty($value['id'])) {
|
||||
return $this->setProjectId($value['id']);
|
||||
}
|
||||
|
||||
// Is this a scalar value representing the ID of this foreign key?
|
||||
return $this->setProjectId($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Project - Accepts a Project model.
|
||||
*
|
||||
* @param $value Project
|
||||
*/
|
||||
public function setProjectObject(Project $value)
|
||||
{
|
||||
return $this->setProjectId($value->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Build model for this BuildMeta by Id.
|
||||
*
|
||||
* @uses \PHPCI\Store\BuildStore::getById()
|
||||
* @uses \PHPCI\Model\Build
|
||||
* @return \PHPCI\Model\Build
|
||||
*/
|
||||
public function getBuild()
|
||||
{
|
||||
$key = $this->getBuildId();
|
||||
|
||||
if (empty($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$cacheKey = 'Cache.Build.' . $key;
|
||||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
$rtn = Factory::getStore('Build', 'PHPCensor')->getById($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Build - Accepts an ID, an array representing a Build or a Build model.
|
||||
*
|
||||
* @param $value mixed
|
||||
*/
|
||||
public function setBuild($value)
|
||||
{
|
||||
// Is this an instance of Build?
|
||||
if ($value instanceof Build) {
|
||||
return $this->setBuildObject($value);
|
||||
}
|
||||
|
||||
// Is this an array representing a Build item?
|
||||
if (is_array($value) && !empty($value['id'])) {
|
||||
return $this->setBuildId($value['id']);
|
||||
}
|
||||
|
||||
// Is this a scalar value representing the ID of this foreign key?
|
||||
return $this->setBuildId($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Build - Accepts a Build model.
|
||||
*
|
||||
* @param $value Build
|
||||
*/
|
||||
public function setBuildObject(Build $value)
|
||||
{
|
||||
return $this->setBuildId($value->getId());
|
||||
}
|
||||
}
|
||||
678
src/PHPCensor/Model/Base/ProjectBase.php
Normal file
678
src/PHPCensor/Model/Base/ProjectBase.php
Normal file
|
|
@ -0,0 +1,678 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Project base model for table: project
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
use b8\Store\Factory;
|
||||
use PHPCensor\Model\ProjectGroup;
|
||||
|
||||
/**
|
||||
* Project Base Model
|
||||
*/
|
||||
class ProjectBase extends Model
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $sleepable = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'project';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = 'Project';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
'reference' => null,
|
||||
'branch' => null,
|
||||
'ssh_private_key' => null,
|
||||
'type' => null,
|
||||
'access_information' => null,
|
||||
'last_commit' => null,
|
||||
'build_config' => null,
|
||||
'ssh_public_key' => null,
|
||||
'allow_public_status' => null,
|
||||
'archived' => null,
|
||||
'group_id' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = [
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'title' => 'getTitle',
|
||||
'reference' => 'getReference',
|
||||
'branch' => 'getBranch',
|
||||
'ssh_private_key' => 'getSshPrivateKey',
|
||||
'type' => 'getType',
|
||||
'access_information' => 'getAccessInformation',
|
||||
'last_commit' => 'getLastCommit',
|
||||
'build_config' => 'getBuildConfig',
|
||||
'ssh_public_key' => 'getSshPublicKey',
|
||||
'allow_public_status' => 'getAllowPublicStatus',
|
||||
'archived' => 'getArchived',
|
||||
'group_id' => 'getGroupId',
|
||||
// Foreign key getters:
|
||||
'Group' => 'getGroup',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = [
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'title' => 'setTitle',
|
||||
'reference' => 'setReference',
|
||||
'branch' => 'setBranch',
|
||||
'ssh_private_key' => 'setSshPrivateKey',
|
||||
'type' => 'setType',
|
||||
'access_information' => 'setAccessInformation',
|
||||
'last_commit' => 'setLastCommit',
|
||||
'build_config' => 'setBuildConfig',
|
||||
'ssh_public_key' => 'setSshPublicKey',
|
||||
'allow_public_status' => 'setAllowPublicStatus',
|
||||
'archived' => 'setArchived',
|
||||
'group_id' => 'setGroupId',
|
||||
// Foreign key setters:
|
||||
'Group' => 'setGroup',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = [
|
||||
'id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'title' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
],
|
||||
'reference' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
],
|
||||
'branch' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => 'master',
|
||||
],
|
||||
'ssh_private_key' => [
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'type' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 50,
|
||||
'default' => null,
|
||||
],
|
||||
'access_information' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'last_commit' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'build_config' => [
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'ssh_public_key' => [
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'allow_public_status' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
],
|
||||
'archived' => [
|
||||
'type' => 'tinyint',
|
||||
'length' => 1,
|
||||
'default' => null,
|
||||
],
|
||||
'group_id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'default' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
'idx_project_title' => ['columns' => 'title'],
|
||||
'group_id' => ['columns' => 'group_id'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = [
|
||||
'project_ibfk_1' => [
|
||||
'local_col' => 'group_id',
|
||||
'update' => 'CASCADE',
|
||||
'delete' => '',
|
||||
'table' => 'project_group',
|
||||
'col' => 'id'
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$rtn = $this->data['id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Title / title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
$rtn = $this->data['title'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Reference / reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReference()
|
||||
{
|
||||
$rtn = $this->data['reference'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Branch / branch.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBranch()
|
||||
{
|
||||
$rtn = $this->data['branch'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of SshPrivateKey / ssh_private_key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSshPrivateKey()
|
||||
{
|
||||
$rtn = $this->data['ssh_private_key'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Type / type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
$rtn = $this->data['type'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of AccessInformation / access_information.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessInformation()
|
||||
{
|
||||
$rtn = $this->data['access_information'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of LastCommit / last_commit.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastCommit()
|
||||
{
|
||||
$rtn = $this->data['last_commit'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of BuildConfig / build_config.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBuildConfig()
|
||||
{
|
||||
$rtn = $this->data['build_config'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of SshPublicKey / ssh_public_key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSshPublicKey()
|
||||
{
|
||||
$rtn = $this->data['ssh_public_key'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of AllowPublicStatus / allow_public_status.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAllowPublicStatus()
|
||||
{
|
||||
$rtn = $this->data['allow_public_status'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Archived / archived.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getArchived()
|
||||
{
|
||||
$rtn = $this->data['archived'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of GroupId / group_id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getGroupId()
|
||||
{
|
||||
$rtn = $this->data['group_id'];
|
||||
|
||||
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);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['id'] = $value;
|
||||
|
||||
$this->_setModified('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Title / title.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->_validateNotNull('Title', $value);
|
||||
$this->_validateString('Title', $value);
|
||||
|
||||
if ($this->data['title'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['title'] = $value;
|
||||
|
||||
$this->_setModified('title');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Reference / reference.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setReference($value)
|
||||
{
|
||||
$this->_validateNotNull('Reference', $value);
|
||||
$this->_validateString('Reference', $value);
|
||||
|
||||
if ($this->data['reference'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['reference'] = $value;
|
||||
|
||||
$this->_setModified('reference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Branch / branch.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setBranch($value)
|
||||
{
|
||||
$this->_validateNotNull('Branch', $value);
|
||||
$this->_validateString('Branch', $value);
|
||||
|
||||
if ($this->data['branch'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['branch'] = $value;
|
||||
|
||||
$this->_setModified('branch');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of SshPrivateKey / ssh_private_key.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setSshPrivateKey($value)
|
||||
{
|
||||
$this->_validateString('SshPrivateKey', $value);
|
||||
|
||||
if ($this->data['ssh_private_key'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['ssh_private_key'] = $value;
|
||||
|
||||
$this->_setModified('ssh_private_key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Type / type.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setType($value)
|
||||
{
|
||||
$this->_validateNotNull('Type', $value);
|
||||
$this->_validateString('Type', $value);
|
||||
|
||||
if ($this->data['type'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['type'] = $value;
|
||||
|
||||
$this->_setModified('type');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of AccessInformation / access_information.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setAccessInformation($value)
|
||||
{
|
||||
$this->_validateString('AccessInformation', $value);
|
||||
|
||||
if ($this->data['access_information'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['access_information'] = $value;
|
||||
|
||||
$this->_setModified('access_information');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of LastCommit / last_commit.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setLastCommit($value)
|
||||
{
|
||||
$this->_validateString('LastCommit', $value);
|
||||
|
||||
if ($this->data['last_commit'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['last_commit'] = $value;
|
||||
|
||||
$this->_setModified('last_commit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of BuildConfig / build_config.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setBuildConfig($value)
|
||||
{
|
||||
$this->_validateString('BuildConfig', $value);
|
||||
|
||||
if ($this->data['build_config'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['build_config'] = $value;
|
||||
|
||||
$this->_setModified('build_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of SshPublicKey / ssh_public_key.
|
||||
*
|
||||
* @param $value string
|
||||
*/
|
||||
public function setSshPublicKey($value)
|
||||
{
|
||||
$this->_validateString('SshPublicKey', $value);
|
||||
|
||||
if ($this->data['ssh_public_key'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['ssh_public_key'] = $value;
|
||||
|
||||
$this->_setModified('ssh_public_key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of AllowPublicStatus / allow_public_status.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setAllowPublicStatus($value)
|
||||
{
|
||||
$this->_validateNotNull('AllowPublicStatus', $value);
|
||||
$this->_validateInt('AllowPublicStatus', $value);
|
||||
|
||||
if ($this->data['allow_public_status'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['allow_public_status'] = $value;
|
||||
|
||||
$this->_setModified('allow_public_status');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Archived / archived.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setArchived($value)
|
||||
{
|
||||
$this->_validateNotNull('Archived', $value);
|
||||
$this->_validateInt('Archived', $value);
|
||||
|
||||
if ($this->data['archived'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['archived'] = $value;
|
||||
|
||||
$this->_setModified('archived');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of GroupId / group_id.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value int
|
||||
*/
|
||||
public function setGroupId($value)
|
||||
{
|
||||
$this->_validateNotNull('GroupId', $value);
|
||||
$this->_validateInt('GroupId', $value);
|
||||
|
||||
if ($this->data['group_id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['group_id'] = $value;
|
||||
|
||||
$this->_setModified('group_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ProjectGroup model for this Project by Id.
|
||||
*
|
||||
* @uses \PHPCI\Store\ProjectGroupStore::getById()
|
||||
* @uses \PHPCI\Model\ProjectGroup
|
||||
* @return \PHPCI\Model\ProjectGroup
|
||||
*/
|
||||
public function getGroup()
|
||||
{
|
||||
$key = $this->getGroupId();
|
||||
|
||||
if (empty($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$cacheKey = 'Cache.ProjectGroup.' . $key;
|
||||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
$rtn = Factory::getStore('ProjectGroup', 'PHPCensor')->getById($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Group - Accepts an ID, an array representing a ProjectGroup or a ProjectGroup model.
|
||||
*
|
||||
* @param $value mixed
|
||||
*/
|
||||
public function setGroup($value)
|
||||
{
|
||||
// Is this an instance of ProjectGroup?
|
||||
if ($value instanceof ProjectGroup) {
|
||||
return $this->setGroupObject($value);
|
||||
}
|
||||
|
||||
// Is this an array representing a ProjectGroup item?
|
||||
if (is_array($value) && !empty($value['id'])) {
|
||||
return $this->setGroupId($value['id']);
|
||||
}
|
||||
|
||||
// Is this a scalar value representing the ID of this foreign key?
|
||||
return $this->setGroupId($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Group - Accepts a ProjectGroup model.
|
||||
*
|
||||
* @param $value ProjectGroup
|
||||
*/
|
||||
public function setGroupObject(ProjectGroup $value)
|
||||
{
|
||||
return $this->setGroupId($value->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Build models by ProjectId for this Project.
|
||||
*
|
||||
* @uses \PHPCensor\Store\BuildStore::getByProjectId()
|
||||
* @uses \PHPCensor\Model\Build
|
||||
* @return \PHPCensor\Model\Build[]
|
||||
*/
|
||||
public function getProjectBuilds()
|
||||
{
|
||||
return Factory::getStore('Build', 'PHPCensor')->getByProjectId($this->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get BuildMeta models by ProjectId for this Project.
|
||||
*
|
||||
* @uses \PHPCensor\Store\BuildMetaStore::getByProjectId()
|
||||
* @uses \PHPCensor\Model\BuildMeta
|
||||
* @return \PHPCensor\Model\BuildMeta[]
|
||||
*/
|
||||
public function getProjectBuildMetas()
|
||||
{
|
||||
return Factory::getStore('BuildMeta', 'PHPCensor')->getByProjectId($this->getId());
|
||||
}
|
||||
}
|
||||
165
src/PHPCensor/Model/Base/ProjectGroupBase.php
Normal file
165
src/PHPCensor/Model/Base/ProjectGroupBase.php
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ProjectGroup base model for table: project_group
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
use b8\Store\Factory;
|
||||
|
||||
/**
|
||||
* ProjectGroup Base Model
|
||||
*/
|
||||
class ProjectGroupBase extends Model
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $sleepable = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'project_group';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = 'ProjectGroup';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'title' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = [
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'title' => 'getTitle',
|
||||
// Foreign key getters:
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = [
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'title' => 'setTitle',
|
||||
// Foreign key setters:
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = [
|
||||
'id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'title' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 100,
|
||||
'default' => null,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = [];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$rtn = $this->data['id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Title / title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
$rtn = $this->data['title'];
|
||||
|
||||
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);
|
||||
|
||||
if ($this->data['id'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['id'] = $value;
|
||||
|
||||
$this->_setModified('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Title / title.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->_validateNotNull('Title', $value);
|
||||
$this->_validateString('Title', $value);
|
||||
|
||||
if ($this->data['title'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['title'] = $value;
|
||||
|
||||
$this->_setModified('title');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Project models by GroupId for this ProjectGroup.
|
||||
*
|
||||
* @uses \PHPCensor\Store\ProjectStore::getByGroupId()
|
||||
* @uses \PHPCensor\Model\Project
|
||||
* @return \PHPCensor\Model\Project[]
|
||||
*/
|
||||
public function getGroupProjects()
|
||||
{
|
||||
return Factory::getStore('Project', 'PHPCensor')->getByGroupId($this->getId());
|
||||
}
|
||||
}
|
||||
274
src/PHPCensor/Model/Base/UserBase.php
Normal file
274
src/PHPCensor/Model/Base/UserBase.php
Normal file
|
|
@ -0,0 +1,274 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* User base model for table: user
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Model\Base;
|
||||
|
||||
use PHPCensor\Model;
|
||||
|
||||
/**
|
||||
* User Base Model
|
||||
*/
|
||||
class UserBase extends Model
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $sleepable = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName = 'user';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $modelName = 'User';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $data = [
|
||||
'id' => null,
|
||||
'email' => null,
|
||||
'hash' => null,
|
||||
'is_admin' => null,
|
||||
'name' => null,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $getters = [
|
||||
// Direct property getters:
|
||||
'id' => 'getId',
|
||||
'email' => 'getEmail',
|
||||
'hash' => 'getHash',
|
||||
'is_admin' => 'getIsAdmin',
|
||||
'name' => 'getName',
|
||||
// Foreign key getters:
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $setters = [
|
||||
// Direct property setters:
|
||||
'id' => 'setId',
|
||||
'email' => 'setEmail',
|
||||
'hash' => 'setHash',
|
||||
'is_admin' => 'setIsAdmin',
|
||||
'name' => 'setName',
|
||||
// Foreign key setters:
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $columns = [
|
||||
'id' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
'primary_key' => true,
|
||||
'auto_increment' => true,
|
||||
'default' => null,
|
||||
],
|
||||
'email' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
],
|
||||
'hash' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
],
|
||||
'is_admin' => [
|
||||
'type' => 'int',
|
||||
'length' => 11,
|
||||
],
|
||||
'name' => [
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $indexes = [
|
||||
'PRIMARY' => ['unique' => true, 'columns' => 'id'],
|
||||
'idx_email' => ['unique' => true, 'columns' => 'email'],
|
||||
'email' => ['unique' => true, 'columns' => 'email'],
|
||||
'name' => ['columns' => 'name'],
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $foreignKeys = [];
|
||||
|
||||
/**
|
||||
* Get the value of Id / id.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
$rtn = $this->data['id'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Email / email.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
$rtn = $this->data['email'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Hash / hash.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHash()
|
||||
{
|
||||
$rtn = $this->data['hash'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of IsAdmin / is_admin.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIsAdmin()
|
||||
{
|
||||
$rtn = $this->data['is_admin'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of Name / name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
$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);
|
||||
|
||||
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
|
||||
*/
|
||||
public function setEmail($value)
|
||||
{
|
||||
$this->_validateNotNull('Email', $value);
|
||||
$this->_validateString('Email', $value);
|
||||
|
||||
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
|
||||
*/
|
||||
public function setHash($value)
|
||||
{
|
||||
$this->_validateNotNull('Hash', $value);
|
||||
$this->_validateString('Hash', $value);
|
||||
|
||||
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
|
||||
*/
|
||||
public function setIsAdmin($value)
|
||||
{
|
||||
$this->_validateNotNull('IsAdmin', $value);
|
||||
$this->_validateInt('IsAdmin', $value);
|
||||
|
||||
if ($this->data['is_admin'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['is_admin'] = $value;
|
||||
|
||||
$this->_setModified('is_admin');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Name / name.
|
||||
*
|
||||
* Must not be null.
|
||||
* @param $value string
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
$this->_validateNotNull('Name', $value);
|
||||
$this->_validateString('Name', $value);
|
||||
|
||||
if ($this->data['name'] === $value) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data['name'] = $value;
|
||||
|
||||
$this->_setModified('name');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue