/** * Gets the project for a specific item, using the new ApplicationSearch. * * This is a transitional method: when every Phabricator will have been * migrated from info (generation 1) or query (generation 2) to search * (generation 3), we'll rename it to getItemProjectsPHIDs and overwrite it. */ protected function getItemProjectsPHIDsThroughApplicationSearch($method, $objectPHID) { if (!$objectPHID) { return []; } $api = PhabricatorAPI::forProject($this->instanceName); $reply = $api->call($method, ['constraints[phids][0]' => $objectPHID, 'attachments[projects]' => 1]); return PhabricatorAPI::getFirstResult($reply)->attachments->projects->projectPHIDs; }
/** * Gets the call sign matching the repository URL. * * @return string the repository call sign "OPS", or "" if not in Phabricator */ private function getCallSign() { $reply = $this->api->call('repository.query', ['remoteURIs[0]' => $this->repository]); if (!count($reply)) { return ""; } return API::getFirstResult($reply)->callsign; }