JiraRestApi\Issue\Transition::setTransitionName PHP Method

setTransitionName() public method

public setTransitionName ( $name )
    public function setTransitionName($name)
    {
        if (is_null($this->transition)) {
            $this->transition = array();
        }
        $this->transition['name'] = $name;
    }

Usage Example

function processPushHook($app)
{
    $json = $app->request->getBody();
    $hook = json_decode($json, true);
    $app->log->debug('processPushHook : ' . json_encode($hook, JSON_PRETTY_PRINT));
    $u = getGitUserName(2, $app);
    foreach ($hook['commits'] as $commit) {
        $app->log->info('Commit : ' . json_encode($commit, JSON_PRETTY_PRINT));
        $issueKey = extractIssueKey($commit['message']);
        if (empty($issueKey)) {
            continue;
        }
        $transitionName = needTransition($commit['message'], $message);
        try {
            if (empty($transitionName)) {
                $comment = new Comment();
                $body = sprintf($message, $u->username, $commit['url']);
                $comment->setBody($body);
                $issueService = new IssueService();
                $ret = $issueService->addComment($issueKey, $comment);
            } else {
                $transition = new Transition();
                $transition->setTransitionName($transitionName);
                $body = sprintf($message, $u->username, $transitionName, $commit['url']);
                $transition->setCommentBody($body);
                $issueService = new IssueService();
                $issueService->transition($issueKey, $transition);
            }
        } catch (JIRAException $e) {
            $app->log->error("add Comment Failed : " . $e->getMessage());
        }
    }
    $app->response->setStatus(200);
}
All Usage Examples Of JiraRestApi\Issue\Transition::setTransitionName