Added 'user_id' column to 'build' table (created by)

+ Renamed columns 'created' -> 'create_date', 'started' -> 'start_date' and 'finished' -> 'finish_date'
+ Code style fixes.
This commit is contained in:
Dmitry Khomutov 2017-10-15 21:58:36 +07:00
commit 4ec6d854c2
29 changed files with 550 additions and 661 deletions

View file

@ -98,8 +98,6 @@ class Project extends Model
];
/**
* Get the value of Id / id.
*
* @return int
*/
public function getId()
@ -110,8 +108,6 @@ class Project extends Model
}
/**
* Get the value of Title / title.
*
* @return string
*/
public function getTitle()
@ -122,8 +118,6 @@ class Project extends Model
}
/**
* Get the value of Reference / reference.
*
* @return string
*/
public function getReference()
@ -134,8 +128,6 @@ class Project extends Model
}
/**
* Get the value of SshPrivateKey / ssh_private_key.
*
* @return string
*/
public function getSshPrivateKey()
@ -146,8 +138,6 @@ class Project extends Model
}
/**
* Get the value of Type / type.
*
* @return string
*/
public function getType()
@ -158,8 +148,6 @@ class Project extends Model
}
/**
* Get the value of LastCommit / last_commit.
*
* @return string
*/
public function getLastCommit()
@ -170,8 +158,6 @@ class Project extends Model
}
/**
* Get the value of BuildConfig / build_config.
*
* @return string
*/
public function getBuildConfig()
@ -182,8 +168,6 @@ class Project extends Model
}
/**
* Get the value of SshPublicKey / ssh_public_key.
*
* @return string
*/
public function getSshPublicKey()
@ -194,8 +178,6 @@ class Project extends Model
}
/**
* Get the value of AllowPublicStatus / allow_public_status.
*
* @return int
*/
public function getAllowPublicStatus()
@ -206,8 +188,6 @@ class Project extends Model
}
/**
* Get the value of Archived / archived.
*
* @return int
*/
public function getArchived()
@ -218,8 +198,6 @@ class Project extends Model
}
/**
* Get the value of GroupId / group_id.
*
* @return int
*/
public function getGroupId()
@ -230,8 +208,6 @@ class Project extends Model
}
/**
* Get the value of DefaultBranchOnly / default_branch_only.
*
* @return int
*/
public function getDefaultBranchOnly()
@ -242,15 +218,12 @@ class Project extends Model
}
/**
* 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);
$this->validateNotNull('id', $value);
$this->validateInt('id', $value);
if ($this->data['id'] === $value) {
return;
@ -262,15 +235,12 @@ class Project extends Model
}
/**
* 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);
$this->validateNotNull('title', $value);
$this->validateString('title', $value);
if ($this->data['title'] === $value) {
return;
@ -282,15 +252,12 @@ class Project extends Model
}
/**
* 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);
$this->validateNotNull('reference', $value);
$this->validateString('reference', $value);
if ($this->data['reference'] === $value) {
return;
@ -302,15 +269,12 @@ class Project extends Model
}
/**
* 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);
$this->validateNotNull('branch', $value);
$this->validateString('branch', $value);
if ($this->data['branch'] === $value) {
return;
@ -322,15 +286,12 @@ class Project extends Model
}
/**
* Set the value of DefaultBranchOnly / default_branch_only.
*
* Must not be null.
* @param $value int
*/
public function setDefaultBranchOnly($value)
{
$this->validateNotNull('DefaultBranchOnly', $value);
$this->validateInt('DefaultBranchOnly', $value);
$this->validateNotNull('default_branch_only', $value);
$this->validateInt('default_branch_only', $value);
if ($this->data['default_branch_only'] === $value) {
return;
@ -342,13 +303,11 @@ class Project extends Model
}
/**
* Set the value of SshPrivateKey / ssh_private_key.
*
* @param $value string
*/
public function setSshPrivateKey($value)
{
$this->validateString('SshPrivateKey', $value);
$this->validateString('ssh_private_key', $value);
if ($this->data['ssh_private_key'] === $value) {
return;
@ -360,15 +319,12 @@ class Project extends Model
}
/**
* 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);
$this->validateNotNull('type', $value);
$this->validateString('type', $value);
if ($this->data['type'] === $value) {
return;
@ -380,13 +336,11 @@ class Project extends Model
}
/**
* Set the value of LastCommit / last_commit.
*
* @param $value string
*/
public function setLastCommit($value)
{
$this->validateString('LastCommit', $value);
$this->validateString('last_commit', $value);
if ($this->data['last_commit'] === $value) {
return;
@ -398,13 +352,11 @@ class Project extends Model
}
/**
* Set the value of BuildConfig / build_config.
*
* @param $value string
*/
public function setBuildConfig($value)
{
$this->validateString('BuildConfig', $value);
$this->validateString('build_config', $value);
if ($this->data['build_config'] === $value) {
return;
@ -416,13 +368,11 @@ class Project extends Model
}
/**
* Set the value of SshPublicKey / ssh_public_key.
*
* @param $value string
*/
public function setSshPublicKey($value)
{
$this->validateString('SshPublicKey', $value);
$this->validateString('ssh_public_key', $value);
if ($this->data['ssh_public_key'] === $value) {
return;
@ -434,15 +384,12 @@ class Project extends Model
}
/**
* 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);
$this->validateNotNull('allow_public_status', $value);
$this->validateInt('allow_public_status', $value);
if ($this->data['allow_public_status'] === $value) {
return;
@ -454,15 +401,12 @@ class Project extends Model
}
/**
* 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);
$this->validateNotNull('archived', $value);
$this->validateInt('archived', $value);
if ($this->data['archived'] === $value) {
return;
@ -474,15 +418,12 @@ class Project extends Model
}
/**
* 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);
$this->validateNotNull('group_id', $value);
$this->validateInt('group_id', $value);
if ($this->data['group_id'] === $value) {
return;
@ -496,8 +437,6 @@ class Project extends Model
/**
* Get the ProjectGroup model for this Project by Id.
*
* @uses \PHPCensor\Store\ProjectGroupStore::getById()
* @uses \PHPCensor\Model\ProjectGroup
* @return \PHPCensor\Model\ProjectGroup
*/
public function getGroup()
@ -508,11 +447,11 @@ class Project extends Model
return null;
}
$cacheKey = 'Cache.ProjectGroup.' . $key;
$rtn = $this->cache->get($cacheKey, null);
$cacheKey = 'Cache.ProjectGroup.' . $key;
$rtn = $this->cache->get($cacheKey, null);
if (empty($rtn)) {
$rtn = Factory::getStore('ProjectGroup', 'PHPCensor')->getById($key);
$rtn = Factory::getStore('ProjectGroup', 'PHPCensor')->getById($key);
$this->cache->set($cacheKey, $rtn);
}
@ -553,8 +492,6 @@ class Project extends Model
/**
* Get Build models by ProjectId for this Project.
*
* @uses \PHPCensor\Store\BuildStore::getByProjectId()
* @uses \PHPCensor\Model\Build
* @return \PHPCensor\Model\Build[]
*/
public function getProjectBuilds()
@ -564,8 +501,10 @@ class Project extends Model
/**
* Return the latest build from a specific branch, of a specific status, for this project.
*
* @param string $branch
* @param null $status
* @param null $status
*
* @return mixed|null
*/
public function getLatestBuild($branch = 'master', $status = null)
@ -592,7 +531,9 @@ class Project extends Model
/**
* Return the previous build from a specific branch, for this project.
*
* @param string $branch
*
* @return mixed|null
*/
public function getPreviousBuild($branch = 'master')
@ -613,7 +554,6 @@ class Project extends Model
}
/**
* Store this project's access_information data
* @param string|array $value
*/
public function setAccessInformation($value)
@ -622,7 +562,7 @@ class Project extends Model
$value = json_encode($value);
}
$this->validateString('AccessInformation', $value);
$this->validateString('access_information', $value);
if ($this->data['access_information'] === $value) {
return;
@ -635,7 +575,9 @@ class Project extends Model
/**
* Get this project's access_information data. Pass a specific key or null for all data.
*
* @param string|null $key
*
* @return mixed|null|string
*/
public function getAccessInformation($key = null)
@ -661,7 +603,7 @@ class Project extends Model
}
/**
* Get the value of Branch / branch.
* Get the value of branch.
*
* @return string
*/
@ -688,6 +630,7 @@ class Project extends Model
/**
* Return the name of a FontAwesome icon to represent this project, depending on its type.
*
* @return string
*/
public function getIcon()
@ -740,7 +683,7 @@ class Project extends Model
if (empty($rtn)) {
$store = $this->getEnvironmentStore();
$rtn = $store->getByProjectId($key);
$rtn = $store->getByProjectId($key);
$this->cache->set($cacheKey, $rtn);
}