-
Notifications
You must be signed in to change notification settings - Fork 180
Closed
Description
In #338 we have deprecated all listing() methods. These methods are the base for the getIdByName() methods.
Getting the ID by a name could easily made by using the new listNames() methods and array_search().
$name = 'Feature';
/** @var int|false */
- $id = $client->getApi('tracker')->getIdByName($name);
+ $id = array_search($name, $client->getApi('tracker')->listNames(), true);However, some endpoints allow name duplications (e.g. projects and versions), so it might become difficult to decide witch ID should be chosen on a name collision.
Instead of editing this methods (to use the listNames() methods internally) and made prediction about name collisions I propose to deprecated them and let the user handle this situation.
Affected methods
CustomField::getIdByName()IssueCategory::getIdByName()IssueStatus::getIdByName()Project::getIdByName()TimeEntryActivity::getIdByName()Tracker::getIdByName()User::getIdByUsername()Version::getIdByName()