Refactored models.
This commit is contained in:
parent
fee4b127b0
commit
fb11ba4652
34 changed files with 2006 additions and 2335 deletions
|
|
@ -43,7 +43,7 @@ class BuildService
|
|||
* @param string|null $commitMessage
|
||||
* @param integer $source
|
||||
* @param integer $userId
|
||||
* @param string|null $extra
|
||||
* @param array|null $extra
|
||||
*
|
||||
* @return \PHPCensor\Model\Build
|
||||
*/
|
||||
|
|
@ -65,8 +65,12 @@ class BuildService
|
|||
$build->setStatus(Build::STATUS_PENDING);
|
||||
$build->setEnvironment($environment);
|
||||
|
||||
if (!is_null($extra)) {
|
||||
$build->setExtra($extra);
|
||||
}
|
||||
|
||||
$branches = $project->getBranchesByEnvironment($environment);
|
||||
$build->setExtraValue('branches', $branches);
|
||||
$build->addExtraValue('branches', $branches);
|
||||
|
||||
$build->setSource($source);
|
||||
$build->setUserId($userId);
|
||||
|
|
@ -90,10 +94,6 @@ class BuildService
|
|||
$build->setCommitMessage($commitMessage);
|
||||
}
|
||||
|
||||
if (!is_null($extra)) {
|
||||
$build->setExtraValues($extra);
|
||||
}
|
||||
|
||||
/** @var Build $build */
|
||||
$build = $this->buildStore->save($build);
|
||||
$buildId = $build->getId();
|
||||
|
|
@ -123,7 +123,7 @@ class BuildService
|
|||
$build->setTag($data['tag']);
|
||||
$build->setCommitterEmail($data['committer_email']);
|
||||
$build->setCommitMessage($data['commit_message']);
|
||||
$build->setExtra($data['extra']);
|
||||
$build->setExtra(json_decode($data['extra'], true));
|
||||
$build->setEnvironment($data['environment']);
|
||||
$build->setSource($data['source']);
|
||||
$build->setUserId($data['user_id']);
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ class ProjectService
|
|||
$project->setTitle($title);
|
||||
$project->setType($type);
|
||||
$project->setReference($reference);
|
||||
$project->setAllowPublicStatus(0);
|
||||
$project->setDefaultBranchOnly(0);
|
||||
$project->setAllowPublicStatus(false);
|
||||
$project->setDefaultBranchOnly(false);
|
||||
|
||||
// Handle extra project options:
|
||||
if (array_key_exists('ssh_private_key', $options)) {
|
||||
|
|
@ -80,11 +80,11 @@ class ProjectService
|
|||
}
|
||||
|
||||
if (array_key_exists('allow_public_status', $options)) {
|
||||
$project->setAllowPublicStatus((int)$options['allow_public_status']);
|
||||
$project->setAllowPublicStatus($options['allow_public_status']);
|
||||
}
|
||||
|
||||
if (array_key_exists('archived', $options)) {
|
||||
$project->setArchived((bool)$options['archived']);
|
||||
$project->setArchived($options['archived']);
|
||||
}
|
||||
|
||||
if (array_key_exists('branch', $options)) {
|
||||
|
|
@ -92,7 +92,7 @@ class ProjectService
|
|||
}
|
||||
|
||||
if (array_key_exists('default_branch_only', $options)) {
|
||||
$project->setDefaultBranchOnly((int)$options['default_branch_only']);
|
||||
$project->setDefaultBranchOnly($options['default_branch_only']);
|
||||
}
|
||||
|
||||
if (array_key_exists('group', $options)) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class UserService
|
|||
* @param string $name
|
||||
* @param string $email
|
||||
* @param string $providerKey
|
||||
* @param string $providerData
|
||||
* @param array $providerData
|
||||
* @param string $password
|
||||
* @param boolean $isAdmin
|
||||
*
|
||||
|
|
@ -43,7 +43,7 @@ class UserService
|
|||
$user->setHash(password_hash($password, PASSWORD_DEFAULT));
|
||||
$user->setProviderKey($providerKey);
|
||||
$user->setProviderData($providerData);
|
||||
$user->setIsAdmin(($isAdmin ? 1 : 0));
|
||||
$user->setIsAdmin($isAdmin);
|
||||
|
||||
return $this->store->save($user);
|
||||
}
|
||||
|
|
@ -71,9 +71,9 @@ class UserService
|
|||
}
|
||||
|
||||
if (!is_null($isAdmin)) {
|
||||
$user->setIsAdmin(($isAdmin ? 1 : 0));
|
||||
$user->setIsAdmin($isAdmin);
|
||||
}
|
||||
|
||||
|
||||
$user->setLanguage($language);
|
||||
$user->setPerPage($perPage);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue