Adding commit message to Build
This commit is contained in:
parent
e888032bdf
commit
eaec52b525
14 changed files with 189 additions and 46 deletions
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace PHPCI\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
use PHPCI\Model;
|
||||
use b8\Store\Factory;
|
||||
|
||||
/**
|
||||
|
|
@ -44,6 +44,7 @@ class BuildBase extends Model
|
|||
'finished' => null,
|
||||
'plugins' => null,
|
||||
'committer_email' => null,
|
||||
'commit_message' => null,
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
@ -62,6 +63,7 @@ class BuildBase extends Model
|
|||
'finished' => 'getFinished',
|
||||
'plugins' => 'getPlugins',
|
||||
'committer_email' => 'getCommitterEmail',
|
||||
'commit_message' => 'getCommitMessage',
|
||||
|
||||
// Foreign key getters:
|
||||
'Project' => 'getProject',
|
||||
|
|
@ -83,6 +85,7 @@ class BuildBase extends Model
|
|||
'finished' => 'setFinished',
|
||||
'plugins' => 'setPlugins',
|
||||
'committer_email' => 'setCommitterEmail',
|
||||
'commit_message' => 'setCommitMessage',
|
||||
|
||||
// Foreign key setters:
|
||||
'Project' => 'setProject',
|
||||
|
|
@ -113,6 +116,7 @@ class BuildBase extends Model
|
|||
'status' => array(
|
||||
'type' => 'tinyint',
|
||||
'length' => 4,
|
||||
'default' => null,
|
||||
),
|
||||
'log' => array(
|
||||
'type' => 'longtext',
|
||||
|
|
@ -150,6 +154,11 @@ class BuildBase extends Model
|
|||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
'commit_message' => array(
|
||||
'type' => 'text',
|
||||
'nullable' => true,
|
||||
'default' => null,
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
@ -318,6 +327,18 @@ class BuildBase extends Model
|
|||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of CommitMessage / commit_message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCommitMessage()
|
||||
{
|
||||
$rtn = $this->data['commit_message'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of Id / id.
|
||||
*
|
||||
|
|
@ -524,6 +545,24 @@ class BuildBase extends Model
|
|||
$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');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Project model for this Build by Id.
|
||||
*
|
||||
|
|
@ -543,24 +582,13 @@ class BuildBase extends Model
|
|||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
$rtn = Factory::getStore('Project')->getById($key);
|
||||
$rtn = Factory::getStore('Project', 'PHPCI')->getById($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the project's Title / title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getProjectTitle()
|
||||
{
|
||||
return $this->getProject()->getTitle();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set Project - Accepts an ID, an array representing a Project or a Project model.
|
||||
*
|
||||
|
|
@ -601,6 +629,33 @@ class BuildBase extends Model
|
|||
*/
|
||||
public function getBuildBuildMetas()
|
||||
{
|
||||
return Factory::getStore('BuildMeta')->getByBuildId($this->getId());
|
||||
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);
|
||||
}
|
||||
|
||||
public static function getByProjectId($value, $limit = null, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('Build', 'PHPCI')->getByProjectId($value, $limit, $useConnection);
|
||||
}
|
||||
|
||||
public static function getByStatus($value, $limit = null, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('Build', 'PHPCI')->getByStatus($value, $limit, $useConnection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace PHPCI\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
use PHPCI\Model;
|
||||
use b8\Store\Factory;
|
||||
|
||||
/**
|
||||
|
|
@ -95,6 +95,7 @@ class BuildMetaBase extends Model
|
|||
'meta_key' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 255,
|
||||
'default' => null,
|
||||
),
|
||||
'meta_value' => array(
|
||||
'type' => 'text',
|
||||
|
|
@ -299,7 +300,7 @@ class BuildMetaBase extends Model
|
|||
$rtn = $this->cache->get($cacheKey, null);
|
||||
|
||||
if (empty($rtn)) {
|
||||
$rtn = Factory::getStore('Build')->getById($key);
|
||||
$rtn = Factory::getStore('Build', 'PHPCI')->getById($key);
|
||||
$this->cache->set($cacheKey, $rtn);
|
||||
}
|
||||
|
||||
|
|
@ -336,4 +337,26 @@ class BuildMetaBase extends Model
|
|||
{
|
||||
return $this->setBuildId($value->getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getByPrimaryKey($value, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('BuildMeta', 'PHPCI')->getByPrimaryKey($value, $useConnection);
|
||||
}
|
||||
|
||||
|
||||
public static function getById($value, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('BuildMeta', 'PHPCI')->getById($value, $useConnection);
|
||||
}
|
||||
|
||||
public static function getByBuildId($value, $limit = null, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('BuildMeta', 'PHPCI')->getByBuildId($value, $limit, $useConnection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace PHPCI\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
use PHPCI\Model;
|
||||
use b8\Store\Factory;
|
||||
|
||||
/**
|
||||
|
|
@ -91,10 +91,12 @@ class ProjectBase extends Model
|
|||
'title' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'reference' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'git_key' => array(
|
||||
'type' => 'text',
|
||||
|
|
@ -215,21 +217,11 @@ class ProjectBase extends Model
|
|||
/**
|
||||
* Get the value of AccessInformation / access_information.
|
||||
*
|
||||
* @param string|null $key Key of desired information
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessInformation($key = null)
|
||||
public function getAccessInformation()
|
||||
{
|
||||
$data = unserialize($this->data['access_information']);
|
||||
|
||||
if (is_null($key)) {
|
||||
$rtn = $data;
|
||||
} else if (isset($data[$key])) {
|
||||
$rtn = $data[$key];
|
||||
} else {
|
||||
$rtn = null;
|
||||
}
|
||||
$rtn = $this->data['access_information'];
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
|
@ -407,6 +399,28 @@ class ProjectBase extends Model
|
|||
*/
|
||||
public function getProjectBuilds()
|
||||
{
|
||||
return Factory::getStore('Build')->getByProjectId($this->getId());
|
||||
return Factory::getStore('Build', 'PHPCI')->getByProjectId($this->getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getByPrimaryKey($value, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('Project', 'PHPCI')->getByPrimaryKey($value, $useConnection);
|
||||
}
|
||||
|
||||
|
||||
public static function getById($value, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('Project', 'PHPCI')->getById($value, $useConnection);
|
||||
}
|
||||
|
||||
public static function getByTitle($value, $limit = null, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('Project', 'PHPCI')->getByTitle($value, $limit, $useConnection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace PHPCI\Model\Base;
|
||||
|
||||
use b8\Model;
|
||||
use PHPCI\Model;
|
||||
use b8\Store\Factory;
|
||||
|
||||
/**
|
||||
|
|
@ -82,14 +82,17 @@ class UserBase extends Model
|
|||
'email' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'hash' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 250,
|
||||
'default' => null,
|
||||
),
|
||||
'is_admin' => array(
|
||||
'type' => 'tinyint',
|
||||
'length' => 1,
|
||||
'default' => null,
|
||||
),
|
||||
'name' => array(
|
||||
'type' => 'varchar',
|
||||
|
|
@ -270,4 +273,26 @@ class UserBase extends Model
|
|||
|
||||
$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);
|
||||
}
|
||||
|
||||
public static function getByEmail($value, $useConnection = 'read')
|
||||
{
|
||||
return Factory::getStore('User', 'PHPCI')->getByEmail($value, $useConnection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue