In IssueTransition::get method returns first element of transitions info, and its very uncomfortable to use IssueTransition::do_safe method?
How it works now:
public function do_safe(string $issue_key, int $transition_id, array $fields = [], array $update = []) : void
{
$TransitionInfo = $this->get($issue_key, $transition_id, true);
foreach ($fields as $field_id => $value) {
if (!isset($TransitionInfo->fields->{$field_id})) {
unset($fields[$field_id]);
}
}
foreach ($update as $field_id => $value) {
if (!isset($TransitionInfo->fields->{$field_id})) {
unset($update[$field_id]);
}
}
$this->do($issue_key, $transition_id, $fields, $update);
}
public function get(string $issue_key, int $transition_id, bool $expand_fields = false) : \stdClass
{
$args = [
'transitionId' => $transition_id,
];
if ($expand_fields) {
$args = ['expand' => 'transitions.fields'];
}
$transitions = $this->Jira->get("/issue/{$issue_key}/transitions", $args)->transitions;
if (empty($transitions)) {
$user = $this->Jira->getLogin();
throw new \Badoo\Jira\REST\Exception(
"Transition '{$transition_id}' of '{$issue_key}' is not available for '{$user}' in current issue status"
);
}
return $transitions[0];
}
As you can see the get method returns first element but there can be more than one.
And now I had situation where I need the second element cause it contains transition_id I do and "fields" I need.
Hi!
In IssueTransition::get method returns first element of transitions info, and its very uncomfortable to use IssueTransition::do_safe method?
How it works now:
As you can see the get method returns first element but there can be more than one. And now I had situation where I need the second element cause it contains transition_id I do and "fields" I need.
Would you fix it please?