本文整理汇总了PHP中thebuggenie\core\entities\Status::getByKeyish方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::getByKeyish方法的具体用法?PHP Status::getByKeyish怎么用?PHP Status::getByKeyish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\Status
的用法示例。
在下文中一共展示了Status::getByKeyish方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadFixtures
public static function loadFixtures(\thebuggenie\core\entities\Scope $scope, \thebuggenie\core\entities\Workflow $workflow)
{
$steps = array();
$steps['new'] = array('name' => 'New', 'description' => 'A new issue, not yet handled', 'status_id' => Status::getByKeyish('new')->getID(), 'transitions' => array('investigateissue', 'confirmissue', 'rejectissue', 'acceptissue', 'resolveissue'), 'editable' => true, 'is_closed' => false);
$steps['investigating'] = array('name' => 'Investigating', 'description' => 'An issue that is being investigated, looked into or is by other means between new and unconfirmed state', 'status_id' => Status::getByKeyish('investigating')->getID(), 'transitions' => array('requestmoreinformation', 'confirmissue', 'rejectissue', 'acceptissue'), 'editable' => true, 'is_closed' => false);
$steps['confirmed'] = array('name' => 'Confirmed', 'description' => 'An issue that has been confirmed', 'status_id' => Status::getByKeyish('confirmed')->getID(), 'transitions' => array('acceptissue', 'assignissue', 'resolveissue'), 'editable' => false, 'is_closed' => false);
$steps['inprogress'] = array('name' => 'In progress', 'description' => 'An issue that is being adressed', 'status_id' => Status::getByKeyish('beingworkedon')->getID(), 'transitions' => array('rejectissue', 'markreadyfortesting', 'resolveissue'), 'editable' => false, 'is_closed' => false);
$steps['readyfortesting'] = array('name' => 'Ready for testing', 'description' => 'An issue that has been marked fixed and is ready for testing', 'status_id' => Status::getByKeyish('readyfortesting/qa')->getID(), 'transitions' => array('resolveissue', 'testissuesolution'), 'editable' => false, 'is_closed' => false);
$steps['testing'] = array('name' => 'Testing', 'description' => 'An issue where the proposed or implemented solution is currently being tested or approved', 'status_id' => Status::getByKeyish('testing/qa')->getID(), 'transitions' => array('acceptissuesolution', 'rejectissuesolution'), 'editable' => false, 'is_closed' => false);
$steps['rejected'] = array('name' => 'Rejected', 'description' => 'A closed issue that has been rejected', 'status_id' => Status::getByKeyish('notabug')->getID(), 'transitions' => array('reopenissue'), 'editable' => false, 'is_closed' => true);
$steps['closed'] = array('name' => 'Closed', 'description' => 'A closed issue', 'status_id' => null, 'transitions' => array('reopenissue'), 'editable' => false, 'is_closed' => true);
foreach ($steps as $key => $step) {
$step_object = new \thebuggenie\core\entities\WorkflowStep();
$step_object->setWorkflow($workflow);
$step_object->setName($step['name']);
$step_object->setDescription($step['description']);
$step_object->setLinkedStatusID($step['status_id']);
$step_object->setIsClosed($step['is_closed']);
$step_object->setIsEditable($step['editable']);
$step_object->save();
$steps[$key]['step'] = $step_object;
}
$transitions = WorkflowTransition::loadFixtures($scope, $workflow, $steps);
$transition = new \thebuggenie\core\entities\WorkflowTransition();
$step = $steps['new']['step'];
$transition->setOutgoingStep($step);
$transition->setName('Issue created');
$transition->setWorkflow($workflow);
$transition->setDescription('This is the initial transition for issues using this workflow');
$transition->save();
$workflow->setInitialTransition($transition);
$workflow->save();
foreach ($steps as $step) {
foreach ($step['transitions'] as $transition) {
$step['step']->addOutgoingTransition($transitions[$transition]);
}
}
}
示例2: loadFixtures
public function loadFixtures(\thebuggenie\core\entities\Scope $scope)
{
$steps = array();
$steps[] = array('name' => 'New', 'description' => 'A new issue, not yet handled', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('new')->getID(), 'editable' => true, 'is_closed' => false);
$steps[] = array('name' => 'Investigating', 'description' => 'An issue that is being investigated, looked into or is by other means between new and unconfirmed state', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('investigating')->getID(), 'editable' => true, 'is_closed' => false);
$steps[] = array('name' => 'Confirmed', 'description' => 'An issue that has been confirmed', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('confirmed')->getID(), 'editable' => false, 'is_closed' => false);
$steps[] = array('name' => 'In progress', 'description' => 'An issue that is being adressed', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('beingworkedon')->getID(), 'editable' => false, 'is_closed' => false);
$steps[] = array('name' => 'Ready for testing', 'description' => 'An issue that has been marked fixed and is ready for testing', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('readyfortesting/qa')->getID(), 'editable' => false, 'is_closed' => false);
$steps[] = array('name' => 'Testing', 'description' => 'An issue where the proposed or implemented solution is currently being tested or approved', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('testing/qa')->getID(), 'editable' => false, 'is_closed' => false);
$steps[] = array('name' => 'Rejected', 'description' => 'A closed issue that has been rejected', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('notabug')->getID(), 'editable' => false, 'is_closed' => true);
$steps[] = array('name' => 'Closed', 'description' => 'A closed issue', 'status_id' => null, 'editable' => false, 'is_closed' => true);
foreach ($steps as $step) {
$crit = $this->getCriteria();
$crit->addInsert(self::WORKFLOW_ID, 1);
$crit->addInsert(self::SCOPE, $scope->getID());
$crit->addInsert(self::NAME, $step['name']);
$crit->addInsert(self::DESCRIPTION, $step['description']);
$crit->addInsert(self::STATUS_ID, $step['status_id']);
$crit->addInsert(self::CLOSED, $step['is_closed']);
$crit->addInsert(self::EDITABLE, $step['editable']);
$this->doInsert($crit);
}
}
示例3: loadFixtures
public static function loadFixtures(\thebuggenie\core\entities\Scope $scope, \thebuggenie\core\entities\Workflow $workflow, $steps)
{
$rejected_resolutions = array();
$rejected_resolutions[] = Resolution::getByKeyish('notanissue')->getID();
$rejected_resolutions[] = Resolution::getByKeyish('wontfix')->getID();
$rejected_resolutions[] = Resolution::getByKeyish('cantfix')->getID();
$rejected_resolutions[] = Resolution::getByKeyish('cantreproduce')->getID();
$rejected_resolutions[] = Resolution::getByKeyish('duplicate')->getID();
$resolved_resolutions = array();
$resolved_resolutions[] = Resolution::getByKeyish('resolved')->getID();
$resolved_resolutions[] = Resolution::getByKeyish('wontfix')->getID();
$resolved_resolutions[] = Resolution::getByKeyish('postponed')->getID();
$resolved_resolutions[] = Resolution::getByKeyish('duplicate')->getID();
$closed_statuses = array();
$closed_statuses[] = Status::getByKeyish('closed')->getID();
$closed_statuses[] = Status::getByKeyish('postponed')->getID();
$closed_statuses[] = Status::getByKeyish('done')->getID();
$closed_statuses[] = Status::getByKeyish('fixed')->getID();
$transitions = array();
$transitions['investigateissue'] = array('name' => 'Investigate issue', 'description' => 'Assign the issue to yourself and start investigating it', 'outgoing_step' => 'investigating', 'template' => null, 'pre_validations' => array(WorkflowTransitionValidationRule::RULE_MAX_ASSIGNED_ISSUES => 5), 'actions' => array(WorkflowTransitionAction::ACTION_ASSIGN_ISSUE_SELF => 0));
$transitions['requestmoreinformation'] = array('name' => 'Request more information', 'description' => 'Move issue back to new state for more details', 'outgoing_step' => 'new', 'template' => 'main/updateissueproperties', 'actions' => array(WorkflowTransitionAction::ACTION_CLEAR_ASSIGNEE => 0));
$transitions['confirmissue'] = array('name' => 'Confirm issue', 'description' => 'Confirm that the issue is valid', 'outgoing_step' => 'confirmed', 'template' => null, 'actions' => array(WorkflowTransitionAction::ACTION_SET_PERCENT => 10));
$transitions['rejectissue'] = array('name' => 'Reject issue', 'description' => 'Reject the issue as invalid', 'outgoing_step' => 'rejected', 'template' => 'main/updateissueproperties', 'post_validations' => array(WorkflowTransitionValidationRule::RULE_RESOLUTION_VALID => join(',', $rejected_resolutions)), 'actions' => array(WorkflowTransitionAction::ACTION_SET_RESOLUTION => 0, WorkflowTransitionAction::ACTION_SET_DUPLICATE => 0, WorkflowTransitionAction::ACTION_SET_PERCENT => 100, WorkflowTransitionAction::ACTION_USER_STOP_WORKING => 0));
$transitions['acceptissue'] = array('name' => 'Accept issue', 'description' => 'Accept the issue and assign it to yourself', 'outgoing_step' => 'inprogress', 'template' => null, 'pre_validations' => array(WorkflowTransitionValidationRule::RULE_MAX_ASSIGNED_ISSUES => 5), 'actions' => array(WorkflowTransitionAction::ACTION_ASSIGN_ISSUE_SELF => 0, WorkflowTransitionAction::ACTION_USER_START_WORKING => 0));
$transitions['reopenissue'] = array('name' => 'Reopen issue', 'description' => 'Reopen the issue', 'outgoing_step' => 'new', 'template' => null, 'actions' => array(WorkflowTransitionAction::ACTION_CLEAR_RESOLUTION => 0, WorkflowTransitionAction::ACTION_CLEAR_DUPLICATE => 0, WorkflowTransitionAction::ACTION_CLEAR_PERCENT => 0));
$transitions['assignissue'] = array('name' => 'Assign issue', 'description' => 'Accept the issue and assign it to someone', 'outgoing_step' => 'inprogress', 'template' => 'main/updateissueproperties', 'actions' => array(WorkflowTransitionAction::ACTION_ASSIGN_ISSUE => 0, WorkflowTransitionAction::ACTION_USER_START_WORKING => 0));
$transitions['markreadyfortesting'] = array('name' => 'Mark ready for testing', 'description' => 'Mark the issue as ready to be tested', 'outgoing_step' => 'readyfortesting', 'template' => null, 'actions' => array(WorkflowTransitionAction::ACTION_CLEAR_ASSIGNEE => 0, WorkflowTransitionAction::ACTION_USER_STOP_WORKING => 0));
$transitions['resolveissue'] = array('name' => 'Resolve issue', 'description' => 'Resolve the issue', 'outgoing_step' => 'closed', 'template' => 'main/updateissueproperties', 'post_validations' => array(WorkflowTransitionValidationRule::RULE_STATUS_VALID => join(',', $closed_statuses), WorkflowTransitionValidationRule::RULE_RESOLUTION_VALID => join(',', $resolved_resolutions)), 'actions' => array(WorkflowTransitionAction::ACTION_SET_STATUS => 0, WorkflowTransitionAction::ACTION_SET_PERCENT => 100, WorkflowTransitionAction::ACTION_SET_RESOLUTION => 0, WorkflowTransitionAction::ACTION_USER_STOP_WORKING => 0));
$transitions['testissuesolution'] = array('name' => 'Test issue solution', 'description' => 'Check whether the solution is valid', 'outgoing_step' => 'testing', 'template' => null, 'actions' => array(WorkflowTransitionAction::ACTION_ASSIGN_ISSUE_SELF => 0, WorkflowTransitionAction::ACTION_USER_START_WORKING => 0));
$transitions['acceptissuesolution'] = array('name' => 'Accept issue solution', 'description' => 'Mark the issue as resolved', 'outgoing_step' => 'closed', 'template' => 'main/updateissueproperties', 'actions' => array(WorkflowTransitionAction::ACTION_SET_RESOLUTION => 0, WorkflowTransitionAction::ACTION_CLEAR_ASSIGNEE => 0, WorkflowTransitionAction::ACTION_USER_STOP_WORKING => 0));
$transitions['rejectissuesolution'] = array('name' => 'Reject issue solution', 'description' => 'Reject the proposed solution and mark the issue as in progress', 'outgoing_step' => 'inprogress', 'template' => null, 'actions' => array(WorkflowTransitionAction::ACTION_SET_RESOLUTION => 0, WorkflowTransitionAction::ACTION_CLEAR_ASSIGNEE => 0, WorkflowTransitionAction::ACTION_USER_STOP_WORKING => 0));
foreach ($transitions as $key => $transition) {
$transition_object = new \thebuggenie\core\entities\WorkflowTransition();
$transition_object->setName($transition['name']);
$transition_object->setDescription($transition['description']);
$transition_object->setOutgoingStep($steps[$transition['outgoing_step']]['step']);
$transition_object->setTemplate($transition['template']);
$transition_object->setWorkflow($workflow);
$transition_object->save();
$transitions[$key] = $transition_object;
if (array_key_exists('pre_validations', $transition) && is_array($transition['pre_validations'])) {
foreach ($transition['pre_validations'] as $type => $validation) {
$rule = new \thebuggenie\core\entities\WorkflowTransitionValidationRule();
$rule->setTransition($transition_object);
$rule->setPre();
$rule->setRule($type);
$rule->setRuleValue($validation);
$rule->setWorkflow($workflow);
$rule->save();
}
}
if (array_key_exists('post_validations', $transition) && is_array($transition['post_validations'])) {
foreach ($transition['post_validations'] as $type => $validation) {
$rule = new \thebuggenie\core\entities\WorkflowTransitionValidationRule();
$rule->setTransition($transition_object);
$rule->setPost();
$rule->setRule($type);
$rule->setRuleValue($validation);
$rule->setWorkflow($workflow);
$rule->save();
}
}
if (array_key_exists('actions', $transition) && is_array($transition['actions'])) {
foreach ($transition['actions'] as $type => $action) {
$action_object = new \thebuggenie\core\entities\WorkflowTransitionAction();
$action_object->setActionType($type);
$action_object->setTransition($transition_object);
$action_object->setWorkflow($workflow);
if (!is_null($action)) {
$action_object->setTargetValue($action);
}
$action_object->save();
}
}
}
return $transitions;
}
示例4: processIncomingEmailCommand
public function processIncomingEmailCommand($content, Issue $issue)
{
if (!$issue->isWorkflowTransitionsAvailable()) {
return false;
}
$lines = preg_split("/(\r?\n)/", $content);
$first_line = array_shift($lines);
$commands = explode(" ", trim($first_line));
$command = array_shift($commands);
foreach ($issue->getAvailableWorkflowTransitions() as $transition) {
if (strpos(str_replace(array(' ', '/'), array('', ''), mb_strtolower($transition->getName())), str_replace(array(' ', '/'), array('', ''), mb_strtolower($command))) !== false) {
foreach ($commands as $single_command) {
if (mb_strpos($single_command, '=')) {
list($key, $val) = explode('=', $single_command);
switch ($key) {
case 'resolution':
if (($resolution = Resolution::getByKeyish($val)) instanceof Resolution) {
framework\Context::getRequest()->setParameter('resolution_id', $resolution->getID());
}
break;
case 'status':
if (($status = Status::getByKeyish($val)) instanceof Status) {
framework\Context::getRequest()->setParameter('status_id', $status->getID());
}
break;
}
}
}
framework\Context::getRequest()->setParameter('comment_body', join("\n", $lines));
return $transition->transitionIssueToOutgoingStepWithoutRequest($issue);
}
}
}
示例5: processCommit
//.........这里部分代码省略.........
$user = \thebuggenie\core\entities\tables\Users::getTable()->getByRealname($author);
}
// c)
if (!$user instanceof \thebuggenie\core\entities\User) {
$user = \thebuggenie\core\entities\tables\Users::getTable()->getByBuddyname($author);
}
// d)
if (!$user instanceof \thebuggenie\core\entities\User) {
$user = \thebuggenie\core\entities\tables\Users::getTable()->getByUsername($author);
}
// e)
if (!$user instanceof \thebuggenie\core\entities\User) {
$user = framework\Settings::getDefaultUser();
}
framework\Context::setUser($user);
framework\Settings::forceSettingsReload();
framework\Context::cacheAllPermissions();
$output .= '[VCS ' . $project->getKey() . '] Commit to be logged by user ' . $user->getName() . "\n";
if ($date == null) {
$date = NOW;
}
// Create the commit data
$commit = new Commit();
$commit->setAuthor($user);
$commit->setDate($date);
$commit->setLog($commit_msg);
$commit->setPreviousRevision($old_rev);
$commit->setRevision($new_rev);
$commit->setProject($project);
if ($branch !== null) {
$data = 'branch:' . $branch;
$commit->setMiscData($data);
}
if ($callback !== null) {
$commit = $callback($commit);
}
$commit->save();
$output .= '[VCS ' . $project->getKey() . '] Commit logged with revision ' . $commit->getRevision() . "\n";
// Iterate over affected issues and update them.
foreach ($issues as $issue) {
$inst = new IssueLink();
$inst->setIssue($issue);
$inst->setCommit($commit);
$inst->save();
// Process all commit-message transitions for an issue.
foreach ($transitions[$issue->getFormattedIssueNo()] as $transition) {
if (framework\Settings::get('vcs_workflow_' . $project->getID(), 'vcs_integration') == self::WORKFLOW_ENABLED) {
framework\Context::setUser($user);
framework\Settings::forceSettingsReload();
framework\Context::cacheAllPermissions();
if ($issue->isWorkflowTransitionsAvailable()) {
// Go through the list of possible transitions for an issue. Only
// process transitions that are applicable to issue's workflow.
foreach ($issue->getAvailableWorkflowTransitions() as $possible_transition) {
if (mb_strtolower($possible_transition->getName()) == mb_strtolower($transition[0])) {
$output .= '[VCS ' . $project->getKey() . '] Running transition ' . $transition[0] . ' on issue ' . $issue->getFormattedIssueNo() . "\n";
// String representation of parameters. Used for log message.
$parameters_string = "";
// Iterate over the list of this transition's parameters, and
// set them.
foreach ($transition[1] as $parameter => $value) {
$parameters_string .= "{$parameter}={$value} ";
switch ($parameter) {
case 'resolution':
if (($resolution = \thebuggenie\core\entities\Resolution::getByKeyish($value)) instanceof \thebuggenie\core\entities\Resolution) {
framework\Context::getRequest()->setParameter('resolution_id', $resolution->getID());
}
break;
case 'status':
if (($status = \thebuggenie\core\entities\Status::getByKeyish($value)) instanceof \thebuggenie\core\entities\Status) {
framework\Context::getRequest()->setParameter('status_id', $status->getID());
}
break;
}
}
// Run the transition.
$possible_transition->transitionIssueToOutgoingStepWithoutRequest($issue);
// Log an informative message about the transition.
$output .= '[VCS ' . $project->getKey() . '] Ran transition ' . $possible_transition->getName() . ' with parameters \'' . $parameters_string . '\' on issue ' . $issue->getFormattedIssueNo() . "\n";
}
}
}
}
}
$issue->addSystemComment(framework\Context::getI18n()->__('This issue has been updated with the latest changes from the code repository.<source>%commit_msg</source>', array('%commit_msg' => $commit_msg)), $user->getID());
$output .= '[VCS ' . $project->getKey() . '] Updated issue ' . $issue->getFormattedIssueNo() . "\n";
}
// Create file links
foreach ($files as $afile) {
// index 0 is action, index 1 is file
$inst = new File();
$inst->setAction($afile[0]);
$inst->setFile($afile[1]);
$inst->setCommit($commit);
$inst->save();
$output .= '[VCS ' . $project->getKey() . '] Added with action ' . $afile[0] . ' file ' . $afile[1] . "\n";
}
framework\Event::createNew('vcs_integration', 'new_commit')->trigger(array('commit' => $commit));
return $output;
}