本文整理汇总了PHP中thebuggenie\core\entities\Issue::setMilestone方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::setMilestone方法的具体用法?PHP Issue::setMilestone怎么用?PHP Issue::setMilestone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\Issue
的用法示例。
在下文中一共展示了Issue::setMilestone方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: perform
public function perform(\thebuggenie\core\entities\Issue $issue, $request = null)
{
switch ($this->_action_type) {
case self::ACTION_ASSIGN_ISSUE_SELF:
$issue->setAssignee(framework\Context::getUser());
break;
case self::ACTION_SET_STATUS:
if ($this->getTargetValue()) {
$issue->setStatus(Status::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setStatus($request['status_id']);
}
break;
case self::ACTION_CLEAR_MILESTONE:
$issue->setMilestone(null);
break;
case self::ACTION_SET_MILESTONE:
if ($this->getTargetValue()) {
$issue->setMilestone(Milestone::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setMilestone($request['milestone_id']);
}
break;
case self::ACTION_CLEAR_PRIORITY:
$issue->setPriority(null);
break;
case self::ACTION_SET_PRIORITY:
if ($this->getTargetValue()) {
$issue->setPriority(Priority::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setPriority($request['priority_id']);
}
break;
case self::ACTION_CLEAR_PERCENT:
$issue->setPercentCompleted(0);
break;
case self::ACTION_SET_PERCENT:
if ($this->getTargetValue()) {
$issue->setPercentCompleted((int) $this->getTargetValue());
} else {
$issue->setPercentCompleted((int) $request['percent_complete_id']);
}
break;
case self::ACTION_CLEAR_DUPLICATE:
$issue->setDuplicateOf(null);
break;
case self::ACTION_SET_DUPLICATE:
$issue->setDuplicateOf($request['duplicate_issue_id']);
break;
case self::ACTION_CLEAR_RESOLUTION:
$issue->setResolution(null);
break;
case self::ACTION_SET_RESOLUTION:
if ($this->getTargetValue()) {
$issue->setResolution(Resolution::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setResolution($request['resolution_id']);
}
break;
case self::ACTION_CLEAR_REPRODUCABILITY:
$issue->setReproducability(null);
break;
case self::ACTION_SET_REPRODUCABILITY:
if ($this->getTargetValue()) {
$issue->setReproducability(Reproducability::getB2DBTable()->selectById((int) $this->getTargetValue()));
} else {
$issue->setReproducability($request['reproducability_id']);
}
break;
case self::ACTION_CLEAR_ASSIGNEE:
$issue->clearAssignee();
break;
case self::ACTION_ASSIGN_ISSUE:
if ($this->getTargetValue()) {
$target_details = explode('_', $this->_target_value);
if ($target_details[0] == 'user') {
$assignee = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $target_details[1]);
} else {
$assignee = Team::getB2DBTable()->selectById((int) $target_details[1]);
}
$issue->setAssignee($assignee);
} else {
$assignee = null;
switch ($request['assignee_type']) {
case 'user':
$assignee = \thebuggenie\core\entities\User::getB2DBTable()->selectById((int) $request['assignee_id']);
break;
case 'team':
$assignee = Team::getB2DBTable()->selectById((int) $request['assignee_id']);
break;
}
if ((bool) $request->getParameter('assignee_teamup', false) && $assignee instanceof \thebuggenie\core\entities\User && $assignee->getID() != framework\Context::getUser()->getID()) {
$team = new \thebuggenie\core\entities\Team();
$team->setName($assignee->getBuddyname() . ' & ' . framework\Context::getUser()->getBuddyname());
$team->setOndemand(true);
$team->save();
$team->addMember($assignee);
$team->addMember(framework\Context::getUser());
$assignee = $team;
}
//.........这里部分代码省略.........
示例2: addChildIssue
/**
* Add a related issue
*
* @param \thebuggenie\core\entities\Issue $related_issue
*
* @return boolean
*/
public function addChildIssue(\thebuggenie\core\entities\Issue $related_issue, $epic = false)
{
if (!($row = tables\IssueRelations::getTable()->getIssueRelation($this->getID(), $related_issue->getID()))) {
if (!$epic && !$this->getMilestone() instanceof Milestone && $related_issue->getMilestone() instanceof Milestone) {
$related_issue->removeMilestone();
$related_issue->save();
} else {
if ($this->getMilestone() instanceof Milestone) {
$related_issue->setMilestone($this->getMilestone()->getID());
$related_issue->save();
}
}
$res = tables\IssueRelations::getTable()->addChildIssue($this->getID(), $related_issue->getID());
$this->_child_issues = null;
$related_issue->addLogEntry(tables\Log::LOG_ISSUE_DEPENDS, framework\Context::getI18n()->__('%issuetype %issue_no now depends on the solution of this %this_issuetype', array('%this_issuetype' => $related_issue->getIssueType()->getName(), '%issuetype' => $this->getIssueType()->getName(), '%issue_no' => $this->getFormattedIssueNo())));
$this->addLogEntry(tables\Log::LOG_ISSUE_DEPENDS, framework\Context::getI18n()->__('This %this_issuetype now depends on the solution of %issuetype %issue_no', array('%this_issuetype' => $this->getIssueType()->getName(), '%issuetype' => $related_issue->getIssueType()->getName(), '%issue_no' => $related_issue->getFormattedIssueNo())));
$this->calculateTime();
$this->save();
$last_updated = time();
$this->touch($last_updated);
$related_issue->touch($last_updated);
return true;
}
return false;
}
示例3: _postIssue
protected function _postIssue(framework\Request $request)
{
$fields_array = $this->selected_project->getReportableFieldsArray($this->issuetype_id);
$issue = new entities\Issue();
$issue->setTitle($this->title);
$issue->setIssuetype($this->issuetype_id);
$issue->setProject($this->selected_project);
if (isset($fields_array['shortname'])) {
$issue->setShortname($this->selected_shortname);
}
if (isset($fields_array['description'])) {
$issue->setDescription($this->selected_description);
$issue->setDescriptionSyntax($this->selected_description_syntax);
}
if (isset($fields_array['reproduction_steps'])) {
$issue->setReproductionSteps($this->selected_reproduction_steps);
$issue->setReproductionStepsSyntax($this->selected_reproduction_steps_syntax);
}
if (isset($fields_array['category']) && $this->selected_category instanceof entities\Datatype) {
$issue->setCategory($this->selected_category->getID());
}
if (isset($fields_array['status']) && $this->selected_status instanceof entities\Datatype) {
$issue->setStatus($this->selected_status->getID());
}
if (isset($fields_array['reproducability']) && $this->selected_reproducability instanceof entities\Datatype) {
$issue->setReproducability($this->selected_reproducability->getID());
}
if (isset($fields_array['resolution']) && $this->selected_resolution instanceof entities\Datatype) {
$issue->setResolution($this->selected_resolution->getID());
}
if (isset($fields_array['severity']) && $this->selected_severity instanceof entities\Datatype) {
$issue->setSeverity($this->selected_severity->getID());
}
if (isset($fields_array['priority']) && $this->selected_priority instanceof entities\Datatype) {
$issue->setPriority($this->selected_priority->getID());
}
if (isset($fields_array['estimated_time'])) {
$issue->setEstimatedTime($this->selected_estimated_time);
}
if (isset($fields_array['spent_time'])) {
$issue->setSpentTime($this->selected_spent_time);
}
if (isset($fields_array['milestone']) || isset($this->selected_milestone)) {
$issue->setMilestone($this->selected_milestone);
}
if (isset($fields_array['percent_complete'])) {
$issue->setPercentCompleted($this->selected_percent_complete);
}
if (isset($fields_array['pain_bug_type'])) {
$issue->setPainBugType($this->selected_pain_bug_type);
}
if (isset($fields_array['pain_likelihood'])) {
$issue->setPainLikelihood($this->selected_pain_likelihood);
}
if (isset($fields_array['pain_effect'])) {
$issue->setPainEffect($this->selected_pain_effect);
}
foreach (entities\CustomDatatype::getAll() as $customdatatype) {
if (!isset($fields_array[$customdatatype->getKey()])) {
continue;
}
if ($customdatatype->hasCustomOptions()) {
if (isset($fields_array[$customdatatype->getKey()]) && $this->selected_customdatatype[$customdatatype->getKey()] instanceof entities\CustomDatatypeOption) {
$selected_option = $this->selected_customdatatype[$customdatatype->getKey()];
$issue->setCustomField($customdatatype->getKey(), $selected_option->getID());
}
} else {
$issue->setCustomField($customdatatype->getKey(), $this->selected_customdatatype[$customdatatype->getKey()]);
}
}
// FIXME: If we set the issue assignee during report issue, this needs to be set INSTEAD of this
if ($this->selected_project->canAutoassign()) {
if (isset($fields_array['component']) && $this->selected_component instanceof entities\Component && $this->selected_component->hasLeader()) {
$issue->setAssignee($this->selected_component->getLeader());
} elseif (isset($fields_array['edition']) && $this->selected_edition instanceof entities\Edition && $this->selected_edition->hasLeader()) {
$issue->setAssignee($this->selected_edition->getLeader());
} elseif ($this->selected_project->hasLeader()) {
$issue->setAssignee($this->selected_project->getLeader());
}
}
if ($request->hasParameter('custom_issue_access') && $this->selected_project->permissionCheck('canlockandeditlockedissues')) {
switch ($request->getParameter('issue_access')) {
case 'public':
case 'public_category':
$issue->setLocked(false);
$issue->setLockedCategory($request->hasParameter('public_category'));
break;
case 'restricted':
$issue->setLocked();
break;
}
} else {
$issue->setLockedFromProject($this->selected_project);
}
framework\Event::listen('core', 'thebuggenie\\core\\entities\\Issue::createNew_pre_notifications', array($this, 'listen_issueCreate'));
$issue->save();
if (isset($this->parent_issue)) {
$issue->addParentIssue($this->parent_issue);
}
if (isset($fields_array['edition']) && $this->selected_edition instanceof entities\Edition) {
//.........这里部分代码省略.........
示例4: runBulkUpdateIssues
public function runBulkUpdateIssues(framework\Request $request)
{
$issue_ids = $request['issue_ids'];
$options = array('issue_ids' => array_values($issue_ids));
framework\Context::loadLibrary('common');
$options['last_updated'] = tbg_formatTime(time(), 20);
if (!empty($issue_ids)) {
$options['bulk_action'] = $request['bulk_action'];
switch ($request['bulk_action']) {
case 'assign_milestone':
$milestone = null;
if ($request['milestone'] == 'new') {
$milestone = new entities\Milestone();
$milestone->setProject(framework\Context::getCurrentProject());
$milestone->setName($request['milestone_name']);
$milestone->save();
$options['milestone_url'] = framework\Context::getRouting()->generate('agile_milestone', array('project_key' => $milestone->getProject()->getKey(), 'milestone_id' => $milestone->getID()));
} elseif ($request['milestone']) {
$milestone = new entities\Milestone($request['milestone']);
}
$milestone_id = $milestone instanceof entities\Milestone ? $milestone->getID() : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$issue->setMilestone($milestone_id);
$issue->save();
}
}
$options['milestone_id'] = $milestone_id;
$options['milestone_name'] = $milestone_id ? $milestone->getName() : '-';
break;
case 'set_status':
if (is_numeric($request['status'])) {
$status = new entities\Status($request['status']);
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$issue->setStatus($status->getID());
$issue->save();
}
}
$options['status'] = array('color' => $status->getColor(), 'name' => $status->getName(), 'id' => $status->getID());
}
break;
case 'set_severity':
if (is_numeric($request['severity'])) {
$severity = $request['severity'] ? new entities\Severity($request['severity']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$severity_id = $severity instanceof entities\Severity ? $severity->getID() : 0;
$issue->setSeverity($severity_id);
$issue->save();
}
}
$options['severity'] = array('name' => $severity instanceof entities\Severity ? $severity->getName() : '-', 'id' => $severity instanceof entities\Severity ? $severity->getID() : 0);
}
break;
case 'set_resolution':
if (is_numeric($request['resolution'])) {
$resolution = $request['resolution'] ? new entities\Resolution($request['resolution']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$resolution_id = $resolution instanceof entities\Resolution ? $resolution->getID() : 0;
$issue->setResolution($resolution_id);
$issue->save();
}
}
$options['resolution'] = array('name' => $resolution instanceof entities\Resolution ? $resolution->getName() : '-', 'id' => $resolution instanceof entities\Resolution ? $resolution->getID() : 0);
}
break;
case 'set_priority':
if (is_numeric($request['priority'])) {
$priority = $request['priority'] ? new entities\Priority($request['priority']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$priority_id = $priority instanceof entities\Priority ? $priority->getID() : 0;
$issue->setPriority($priority_id);
$issue->save();
}
}
$options['priority'] = array('name' => $priority instanceof entities\Priority ? $priority->getName() : '-', 'id' => $priority instanceof entities\Priority ? $priority->getID() : 0);
}
break;
case 'set_category':
if (is_numeric($request['category'])) {
$category = $request['category'] ? new entities\Category($request['category']) : null;
foreach (array_keys($issue_ids) as $issue_id) {
if (is_numeric($issue_id)) {
$issue = new entities\Issue($issue_id);
$category_id = $category instanceof entities\Category ? $category->getID() : 0;
$issue->setCategory($category_id);
$issue->save();
}
}
$options['category'] = array('name' => $category instanceof entities\Category ? $category->getName() : '-', 'id' => $category instanceof entities\Category ? $category->getID() : 0);
}
break;
//.........这里部分代码省略.........
示例5: _postIssue
protected function _postIssue()
{
$fields_array = $this->selected_project->getReportableFieldsArray($this->issuetype_id);
$issue = new entities\Issue();
$issue->setTitle($this->title);
$issue->setIssuetype($this->issuetype_id);
$issue->setProject($this->selected_project);
if (isset($fields_array['shortname'])) {
$issue->setShortname($this->selected_shortname);
}
if (isset($fields_array['description'])) {
$issue->setDescription($this->selected_description);
$issue->setDescriptionSyntax($this->selected_description_syntax);
}
if (isset($fields_array['reproduction_steps'])) {
$issue->setReproductionSteps($this->selected_reproduction_steps);
$issue->setReproductionStepsSyntax($this->selected_reproduction_steps_syntax);
}
if (isset($fields_array['category']) && $this->selected_category instanceof entities\Datatype) {
$issue->setCategory($this->selected_category->getID());
}
if (isset($fields_array['status']) && $this->selected_status instanceof entities\Datatype) {
$issue->setStatus($this->selected_status->getID());
}
if (isset($fields_array['reproducability']) && $this->selected_reproducability instanceof entities\Datatype) {
$issue->setReproducability($this->selected_reproducability->getID());
}
if (isset($fields_array['resolution']) && $this->selected_resolution instanceof entities\Datatype) {
$issue->setResolution($this->selected_resolution->getID());
}
if (isset($fields_array['severity']) && $this->selected_severity instanceof entities\Datatype) {
$issue->setSeverity($this->selected_severity->getID());
}
if (isset($fields_array['priority']) && $this->selected_priority instanceof entities\Datatype) {
$issue->setPriority($this->selected_priority->getID());
}
if (isset($fields_array['estimated_time'])) {
$issue->setEstimatedTime($this->selected_estimated_time);
}
if (isset($fields_array['spent_time'])) {
$issue->setSpentTime($this->selected_spent_time);
}
if (isset($fields_array['milestone']) || isset($this->selected_milestone)) {
$issue->setMilestone($this->selected_milestone);
}
if (isset($fields_array['percent_complete'])) {
$issue->setPercentCompleted($this->selected_percent_complete);
}
if (isset($fields_array['pain_bug_type'])) {
$issue->setPainBugType($this->selected_pain_bug_type);
}
if (isset($fields_array['pain_likelihood'])) {
$issue->setPainLikelihood($this->selected_pain_likelihood);
}
if (isset($fields_array['pain_effect'])) {
$issue->setPainEffect($this->selected_pain_effect);
}
foreach (entities\CustomDatatype::getAll() as $customdatatype) {
if (!isset($fields_array[$customdatatype->getKey()])) {
continue;
}
if ($customdatatype->hasCustomOptions()) {
if (isset($fields_array[$customdatatype->getKey()]) && $this->selected_customdatatype[$customdatatype->getKey()] instanceof entities\CustomDatatypeOption) {
$selected_option = $this->selected_customdatatype[$customdatatype->getKey()];
$issue->setCustomField($customdatatype->getKey(), $selected_option->getID());
}
} else {
$issue->setCustomField($customdatatype->getKey(), $this->selected_customdatatype[$customdatatype->getKey()]);
}
}
// FIXME: If we set the issue assignee during report issue, this needs to be set INSTEAD of this
if ($this->selected_project->canAutoassign()) {
if (isset($fields_array['component']) && $this->selected_component instanceof entities\Component && $this->selected_component->hasLeader()) {
$issue->setAssignee($this->selected_component->getLeader());
} elseif (isset($fields_array['edition']) && $this->selected_edition instanceof entities\Edition && $this->selected_edition->hasLeader()) {
$issue->setAssignee($this->selected_edition->getLeader());
} elseif ($this->selected_project->hasLeader()) {
$issue->setAssignee($this->selected_project->getLeader());
}
}
$issue->save();
if (isset($this->parent_issue)) {
$issue->addParentIssue($this->parent_issue);
}
if (isset($fields_array['edition']) && $this->selected_edition instanceof entities\Edition) {
$issue->addAffectedEdition($this->selected_edition);
}
if (isset($fields_array['build']) && $this->selected_build instanceof entities\Build) {
$issue->addAffectedBuild($this->selected_build);
}
if (isset($fields_array['component']) && $this->selected_component instanceof entities\Component) {
$issue->addAffectedComponent($this->selected_component);
}
return $issue;
}
示例6: runDoImportCSV
//.........这里部分代码省略.........
try {
$activerow = $data[$i];
$issue = new entities\Issue();
$issue->setTitle($activerow[self::CSV_ISSUE_TITLE]);
$issue->setProject($activerow[self::CSV_ISSUE_PROJECT]);
$issue->setIssuetype($activerow[self::CSV_ISSUE_ISSUE_TYPE]);
$issue->save();
if (isset($activerow[self::CSV_ISSUE_DESCR])) {
$issue->setDescription($activerow[self::CSV_ISSUE_DESCR]);
}
if (isset($activerow[self::CSV_ISSUE_REPRO])) {
$issue->setReproductionSteps($activerow[self::CSV_ISSUE_REPRO]);
}
if (isset($activerow[self::CSV_ISSUE_STATE])) {
$issue->setState($activerow[self::CSV_ISSUE_STATE]);
}
if (isset($activerow[self::CSV_ISSUE_STATUS])) {
$issue->setStatus($activerow[self::CSV_ISSUE_STATUS]);
}
if (isset($activerow[self::CSV_ISSUE_POSTED_BY])) {
$issue->setPostedBy(entities\User::getB2DBTable()->selectByID($activerow[self::CSV_ISSUE_POSTED_BY]));
}
if (isset($activerow[self::CSV_ISSUE_OWNER]) && isset($activerow[self::CSV_ISSUE_OWNER_TYPE])) {
switch ($activerow[self::CSV_ISSUE_OWNER_TYPE]) {
case self::CSV_IDENTIFIER_TYPE_USER:
$user = new entities\User($activerow[self::CSV_ISSUE_OWNER]);
$issue->setOwner($user);
break;
case self::CSV_IDENTIFIER_TYPE_TEAM:
$team = new entities\Team($activerow[self::CSV_ISSUE_OWNER]);
$issue->setOwner($team);
break;
}
}
if (isset($activerow[self::CSV_ISSUE_ASSIGNED]) && isset($activerow[self::CSV_ISSUE_ASSIGNED_TYPE])) {
switch ($activerow[self::CSV_ISSUE_ASSIGNED_TYPE]) {
case self::CSV_IDENTIFIER_TYPE_USER:
$user = new entities\User($activerow[self::CSV_ISSUE_ASSIGNED]);
$issue->setAssignee($user);
break;
case self::CSV_IDENTIFIER_TYPE_TEAM:
$team = new entities\Team($activerow[self::CSV_ISSUE_ASSIGNED]);
$issue->setAssignee($team);
break;
}
}
if (isset($activerow[self::CSV_ISSUE_RESOLUTION])) {
$issue->setResolution($activerow[self::CSV_ISSUE_RESOLUTION]);
}
if (isset($activerow[self::CSV_ISSUE_PRIORITY])) {
$issue->setPriority($activerow[self::CSV_ISSUE_PRIORITY]);
}
if (isset($activerow[self::CSV_ISSUE_CATEGORY])) {
$issue->setCategory($activerow[self::CSV_ISSUE_CATEGORY]);
}
if (isset($activerow[self::CSV_ISSUE_BLOCKING])) {
$issue->setBlocking($activerow[self::CSV_ISSUE_BLOCKING]);
}
if (isset($activerow[self::CSV_ISSUE_SEVERITY])) {
$issue->setSeverity($activerow[self::CSV_ISSUE_SEVERITY]);
}
if (isset($activerow[self::CSV_ISSUE_REPRODUCIBILITY])) {
$issue->setReproducability($activerow[self::CSV_ISSUE_REPRODUCIBILITY]);
}
if (isset($activerow[self::CSV_ISSUE_VOTES])) {
$issue->setVotes($activerow[self::CSV_ISSUE_VOTES]);
}
if (isset($activerow[self::CSV_ISSUE_PERCENTAGE])) {
$issue->setPercentCompleted($activerow[self::CSV_ISSUE_PERCENTAGE]);
}
if (isset($activerow[self::CSV_ISSUE_ISSUENO])) {
$issue->setIssueNo((int) $activerow[self::CSV_ISSUE_ISSUENO]);
}
if (isset($activerow[self::CSV_ISSUE_MILESTONE])) {
$issue->setMilestone($activerow[self::CSV_ISSUE_MILESTONE]);
}
if (isset($activerow[self::CSV_ISSUE_POSTED])) {
$issue->setPosted((int) $activerow[self::CSV_ISSUE_POSTED]);
}
$issue->save();
} catch (\Exception $e) {
$errors[] = $this->getI18n()->__('Row %row failed: %err', array('%row' => $i + 1, '%err' => $e->getMessage()));
}
}
break;
}
// Handle errors
if (count($errors) != 0) {
$errordiv = '<ul>';
foreach ($errors as $error) {
$errordiv .= '<li>' . $error . '</li>';
}
$errordiv .= '</ul>';
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('errordetail' => $errordiv, 'error' => $this->getI18n()->__('Errors occured while importing, see the error list in the import screen for further details')));
} else {
return $this->renderJSON(array('message' => $this->getI18n()->__('Successfully imported %num rows!', array('%num' => count($data)))));
}
}
}