Genereted models by console phpci:generate command

This commit is contained in:
Dmitry Khomutov 2014-04-10 23:52:21 +07:00
commit 94b2a8a5c5
8 changed files with 639 additions and 759 deletions

View file

@ -3,7 +3,6 @@
/**
* Build base model for table: build
*/
namespace PHPCI\Model\Base;
use PHPCI\Model;
@ -15,336 +14,323 @@ use b8\Store\Factory;
class BuildBase extends Model
{
/**
* @var array
*/
* @var array
*/
public static $sleepable = array();
/**
* @var string
*/
* @var string
*/
protected $tableName = 'build';
/**
* @var string
*/
* @var string
*/
protected $modelName = 'Build';
/**
* @var array
*/
* @var array
*/
protected $data = array(
'id' => null,
'project_id' => null,
'commit_id' => null,
'status' => null,
'log' => null,
'branch' => null,
'created' => null,
'started' => null,
'finished' => null,
'plugins' => null,
'id' => null,
'project_id' => null,
'commit_id' => null,
'status' => null,
'log' => null,
'branch' => null,
'created' => null,
'started' => null,
'finished' => null,
'plugins' => null,
'committer_email' => null,
'commit_message' => null,
'commit_message' => null,
);
/**
* @var array
*/
* @var array
*/
protected $getters = array(
// Direct property getters:
'id' => 'getId',
'project_id' => 'getProjectId',
'commit_id' => 'getCommitId',
'status' => 'getStatus',
'log' => 'getLog',
'branch' => 'getBranch',
'created' => 'getCreated',
'started' => 'getStarted',
'finished' => 'getFinished',
'plugins' => 'getPlugins',
'id' => 'getId',
'project_id' => 'getProjectId',
'commit_id' => 'getCommitId',
'status' => 'getStatus',
'log' => 'getLog',
'branch' => 'getBranch',
'created' => 'getCreated',
'started' => 'getStarted',
'finished' => 'getFinished',
'plugins' => 'getPlugins',
'committer_email' => 'getCommitterEmail',
'commit_message' => 'getCommitMessage',
'commit_message' => 'getCommitMessage',
// Foreign key getters:
'Project' => 'getProject',
'Project' => 'getProject',
);
/**
* @var array
*/
* @var array
*/
protected $setters = array(
// Direct property setters:
'id' => 'setId',
'project_id' => 'setProjectId',
'commit_id' => 'setCommitId',
'status' => 'setStatus',
'log' => 'setLog',
'branch' => 'setBranch',
'created' => 'setCreated',
'started' => 'setStarted',
'finished' => 'setFinished',
'plugins' => 'setPlugins',
'id' => 'setId',
'project_id' => 'setProjectId',
'commit_id' => 'setCommitId',
'status' => 'setStatus',
'log' => 'setLog',
'branch' => 'setBranch',
'created' => 'setCreated',
'started' => 'setStarted',
'finished' => 'setFinished',
'plugins' => 'setPlugins',
'committer_email' => 'setCommitterEmail',
'commit_message' => 'setCommitMessage',
'commit_message' => 'setCommitMessage',
// Foreign key setters:
'Project' => 'setProject',
'Project' => 'setProject',
);
/**
* @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,
),
'project_id' => array(
'type' => 'int',
'length' => 11,
'default' => null,
),
'project_id' => array(
'type' => 'int',
'length' => 11,
'default' => null,
),
'commit_id' => array(
'type' => 'varchar',
'length' => 50,
'commit_id' => array(
'type' => 'varchar',
'length' => 50,
'nullable' => true,
'default' => null,
),
'status' => array(
'type' => 'tinyint',
'length' => 4,
'default' => null,
),
'status' => array(
'type' => 'tinyint',
'length' => 4,
'default' => null,
),
'log' => array(
'type' => 'longtext',
'log' => array(
'type' => 'longtext',
'nullable' => true,
'default' => null,
'default' => null,
),
'branch' => array(
'type' => 'varchar',
'length' => 50,
'branch' => array(
'type' => 'varchar',
'length' => 50,
'default' => 'master',
),
'created' => array(
'type' => 'datetime',
'created' => array(
'type' => 'datetime',
'nullable' => true,
'default' => null,
'default' => null,
),
'started' => array(
'type' => 'datetime',
'started' => array(
'type' => 'datetime',
'nullable' => true,
'default' => null,
'default' => null,
),
'finished' => array(
'type' => 'datetime',
'finished' => array(
'type' => 'datetime',
'nullable' => true,
'default' => null,
'default' => null,
),
'plugins' => array(
'type' => 'text',
'plugins' => array(
'type' => 'text',
'nullable' => true,
'default' => null,
'default' => null,
),
'committer_email' => array(
'type' => 'varchar',
'length' => 512,
'type' => 'varchar',
'length' => 512,
'nullable' => true,
'default' => null,
'default' => null,
),
'commit_message' => array(
'type' => 'text',
'commit_message' => array(
'type' => 'text',
'nullable' => true,
'default' => null,
'default' => null,
),
);
/**
* @var array
*/
* @var array
*/
public $indexes = array(
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
'project_id' => array('columns' => 'project_id'),
'idx_status' => array('columns' => 'status'),
'PRIMARY' => array('unique' => true, 'columns' => 'id'),
'project_id' => array('columns' => 'project_id'),
'idx_status' => array('columns' => 'status'),
);
/**
* @var array
*/
* @var array
*/
public $foreignKeys = array(
'build_ibfk_1' => array(
'local_col' => 'project_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'project',
'col' => 'id'
),
'build_ibfk_1' => array(
'local_col' => 'project_id',
'update' => 'CASCADE',
'delete' => 'CASCADE',
'table' => 'project',
'col' => 'id'
),
);
/**
* 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 ProjectId / project_id.
*
* @return int
*/
* Get the value of ProjectId / project_id.
*
* @return int
*/
public function getProjectId()
{
$rtn = $this->data['project_id'];
$rtn = $this->data['project_id'];
return $rtn;
}
/**
* Get the value of CommitId / commit_id.
*
* @return string
*/
* Get the value of CommitId / commit_id.
*
* @return string
*/
public function getCommitId()
{
$rtn = $this->data['commit_id'];
$rtn = $this->data['commit_id'];
return $rtn;
}
/**
* Get the value of Status / status.
*
* @return int
*/
* Get the value of Status / status.
*
* @return int
*/
public function getStatus()
{
$rtn = $this->data['status'];
$rtn = $this->data['status'];
return $rtn;
}
/**
* Get the value of Log / log.
*
* @return string
*/
* Get the value of Log / log.
*
* @return string
*/
public function getLog()
{
$rtn = $this->data['log'];
$rtn = $this->data['log'];
return $rtn;
}
/**
* Get the value of Branch / branch.
*
* @return string
*/
* Get the value of Branch / branch.
*
* @return string
*/
public function getBranch()
{
$rtn = $this->data['branch'];
$rtn = $this->data['branch'];
return $rtn;
}
/**
* Get the value of Created / created.
*
* @return \DateTime
*/
* Get the value of Created / created.
*
* @return \DateTime
*/
public function getCreated()
{
$rtn = $this->data['created'];
$rtn = $this->data['created'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* Get the value of Started / started.
*
* @return \DateTime
*/
* Get the value of Started / started.
*
* @return \DateTime
*/
public function getStarted()
{
$rtn = $this->data['started'];
$rtn = $this->data['started'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* Get the value of Finished / finished.
*
* @return \DateTime
*/
* Get the value of Finished / finished.
*
* @return \DateTime
*/
public function getFinished()
{
$rtn = $this->data['finished'];
$rtn = $this->data['finished'];
if (!empty($rtn)) {
$rtn = new \DateTime($rtn);
$rtn = new \DateTime($rtn);
}
return $rtn;
}
/**
* Get the value of Plugins / plugins.
*
* @return string
*/
* Get the value of Plugins / plugins.
*
* @return string
*/
public function getPlugins()
{
$rtn = $this->data['plugins'];
$rtn = $this->data['plugins'];
return $rtn;
}
/**
* Get the value of CommitterEmail / committer_email.
*
* @return string
*/
* Get the value of CommitterEmail / committer_email.
*
* @return string
*/
public function getCommitterEmail()
{
$rtn = $this->data['committer_email'];
$rtn = $this->data['committer_email'];
return $rtn;
}
/**
* Get the value of CommitMessage / commit_message.
*
* @return string
*/
* Get the value of CommitMessage / commit_message.
*
* @return string
*/
public function getCommitMessage()
{
$rtn = $this->data['commit_message'];
$rtn = $this->data['commit_message'];
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);
@ -353,18 +339,17 @@ class BuildBase extends Model
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
*/
* Set the value of ProjectId / project_id.
*
* Must not be null.
*
* @param $value int
*/
public function setProjectId($value)
{
$this->_validateNotNull('ProjectId', $value);
@ -373,17 +358,15 @@ class BuildBase extends Model
if ($this->data['project_id'] === $value) {
return;
}
$this->data['project_id'] = $value;
$this->_setModified('project_id');
}
/**
* Set the value of CommitId / commit_id.
*
* @param $value string
*/
* Set the value of CommitId / commit_id.
*
* @param $value string
*/
public function setCommitId($value)
{
$this->_validateString('CommitId', $value);
@ -391,18 +374,17 @@ class BuildBase extends Model
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
*/
* Set the value of Status / status.
*
* Must not be null.
*
* @param $value int
*/
public function setStatus($value)
{
$this->_validateNotNull('Status', $value);
@ -411,17 +393,15 @@ class BuildBase extends Model
if ($this->data['status'] === $value) {
return;
}
$this->data['status'] = $value;
$this->_setModified('status');
}
/**
* Set the value of Log / log.
*
* @param $value string
*/
* Set the value of Log / log.
*
* @param $value string
*/
public function setLog($value)
{
$this->_validateString('Log', $value);
@ -429,18 +409,17 @@ class BuildBase extends Model
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
*/
* Set the value of Branch / branch.
*
* Must not be null.
*
* @param $value string
*/
public function setBranch($value)
{
$this->_validateNotNull('Branch', $value);
@ -449,17 +428,15 @@ class BuildBase extends Model
if ($this->data['branch'] === $value) {
return;
}
$this->data['branch'] = $value;
$this->_setModified('branch');
}
/**
* Set the value of Created / created.
*
* @param $value \DateTime
*/
* Set the value of Created / created.
*
* @param $value \DateTime
*/
public function setCreated($value)
{
$this->_validateDate('Created', $value);
@ -467,17 +444,15 @@ class BuildBase extends Model
if ($this->data['created'] === $value) {
return;
}
$this->data['created'] = $value;
$this->_setModified('created');
}
/**
* Set the value of Started / started.
*
* @param $value \DateTime
*/
* Set the value of Started / started.
*
* @param $value \DateTime
*/
public function setStarted($value)
{
$this->_validateDate('Started', $value);
@ -485,17 +460,15 @@ class BuildBase extends Model
if ($this->data['started'] === $value) {
return;
}
$this->data['started'] = $value;
$this->_setModified('started');
}
/**
* Set the value of Finished / finished.
*
* @param $value \DateTime
*/
* Set the value of Finished / finished.
*
* @param $value \DateTime
*/
public function setFinished($value)
{
$this->_validateDate('Finished', $value);
@ -503,17 +476,15 @@ class BuildBase extends Model
if ($this->data['finished'] === $value) {
return;
}
$this->data['finished'] = $value;
$this->_setModified('finished');
}
/**
* Set the value of Plugins / plugins.
*
* @param $value string
*/
* Set the value of Plugins / plugins.
*
* @param $value string
*/
public function setPlugins($value)
{
$this->_validateString('Plugins', $value);
@ -521,17 +492,15 @@ class BuildBase extends Model
if ($this->data['plugins'] === $value) {
return;
}
$this->data['plugins'] = $value;
$this->_setModified('plugins');
}
/**
* Set the value of CommitterEmail / committer_email.
*
* @param $value string
*/
* Set the value of CommitterEmail / committer_email.
*
* @param $value string
*/
public function setCommitterEmail($value)
{
$this->_validateString('CommitterEmail', $value);
@ -539,17 +508,15 @@ class BuildBase extends Model
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
*/
* Set the value of CommitMessage / commit_message.
*
* @param $value string
*/
public function setCommitMessage($value)
{
$this->_validateString('CommitMessage', $value);
@ -557,9 +524,7 @@ class BuildBase extends Model
if ($this->data['commit_message'] === $value) {
return;
}
$this->data['commit_message'] = $value;
$this->_setModified('commit_message');
}
@ -578,22 +543,21 @@ class BuildBase extends Model
return null;
}
$cacheKey = 'Cache.Project.' . $key;
$rtn = $this->cache->get($cacheKey, null);
$cacheKey = 'Cache.Project.' . $key;
$rtn = $this->cache->get($cacheKey, null);
if (empty($rtn)) {
$rtn = Factory::getStore('Project', 'PHPCI')->getById($key);
$rtn = Factory::getStore('Project', 'PHPCI')->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
*/
* 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?
@ -611,15 +575,16 @@ class BuildBase extends Model
}
/**
* Set Project - Accepts a Project model.
*
* @param $value \PHPCI\Model\Project
*/
* Set Project - Accepts a Project model.
*
* @param $value \PHPCI\Model\Project
*/
public function setProjectObject(\PHPCI\Model\Project $value)
{
return $this->setProjectId($value->getId());
}
/**
* Get BuildMeta models by BuildId for this Build.
*
@ -632,15 +597,11 @@ class BuildBase extends Model
return Factory::getStore('BuildMeta', 'PHPCI')->getByBuildId($this->getId());
}
public static function getByPrimaryKey($value, $useConnection = 'read')
{
return Factory::getStore('Build', 'PHPCI')->getByPrimaryKey($value, $useConnection);
}
public static function getById($value, $useConnection = 'read')
{
return Factory::getStore('Build', 'PHPCI')->getById($value, $useConnection);
@ -655,7 +616,4 @@ class BuildBase extends Model
{
return Factory::getStore('Build', 'PHPCI')->getByStatus($value, $limit, $useConnection);
}
}