Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/phid/HarbormasterBuildablePHIDType.php
Show All 15 Lines | public function getPHIDTypeApplicationClass() { | ||||
return 'PhabricatorHarbormasterApplication'; | return 'PhabricatorHarbormasterApplication'; | ||||
} | } | ||||
protected function buildQueryForObjects( | protected function buildQueryForObjects( | ||||
PhabricatorObjectQuery $query, | PhabricatorObjectQuery $query, | ||||
array $phids) { | array $phids) { | ||||
return id(new HarbormasterBuildableQuery()) | return id(new HarbormasterBuildableQuery()) | ||||
->withPHIDs($phids) | ->withPHIDs($phids); | ||||
->needBuildableHandles(true); | |||||
} | } | ||||
public function loadHandles( | public function loadHandles( | ||||
PhabricatorHandleQuery $query, | PhabricatorHandleQuery $query, | ||||
array $handles, | array $handles, | ||||
array $objects) { | array $objects) { | ||||
$viewer = $this->getViewer(); | |||||
$target_phids = array(); | |||||
foreach ($objects as $phid => $object) { | |||||
$target_phids[] = $object->getBuildablePHID(); | |||||
} | |||||
$target_handles = $viewer->loadHandles($target_phids); | |||||
foreach ($handles as $phid => $handle) { | foreach ($handles as $phid => $handle) { | ||||
$buildable = $objects[$phid]; | $buildable = $objects[$phid]; | ||||
$id = $buildable->getID(); | $id = $buildable->getID(); | ||||
$target = $buildable->getBuildableHandle()->getFullName(); | $buildable_phid = $buildable->getBuildablePHID(); | ||||
$target = $target_handles[$buildable_phid]; | |||||
$target_name = $target->getFullName(); | |||||
$uri = $buildable->getURI(); | |||||
$monogram = $buildable->getMonogram(); | |||||
$handle->setURI("/B{$id}"); | $handle | ||||
$handle->setName("B{$id}"); | ->setURI($uri) | ||||
$handle->setFullName("B{$id}: ".$target); | ->setName($monogram) | ||||
->setFullName("{$monogram}: {$target_name}"); | |||||
} | } | ||||
} | } | ||||
public function canLoadNamedObject($name) { | public function canLoadNamedObject($name) { | ||||
return preg_match('/^B\d*[1-9]\d*$/i', $name); | return preg_match('/^B\d*[1-9]\d*$/i', $name); | ||||
} | } | ||||
public function loadNamedObjects( | public function loadNamedObjects( | ||||
Show All 25 Lines |