本文整理汇总了PHP中thebuggenie\core\entities\Issue::setVotes方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::setVotes方法的具体用法?PHP Issue::setVotes怎么用?PHP Issue::setVotes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\entities\Issue
的用法示例。
在下文中一共展示了Issue::setVotes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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)))));
}
}
}