mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Add PHIDType for HeraldTransaction
Test Plan: Paste a HLXS phid to the quick-search box, get transaction page. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D15028
This commit is contained in:
parent
98d2370672
commit
aadc1b7bf0
4 changed files with 59 additions and 1 deletions
|
@ -1201,6 +1201,7 @@ phutil_register_library_map(array(
|
|||
'HeraldTranscriptDestructionEngineExtension' => 'applications/herald/engineextension/HeraldTranscriptDestructionEngineExtension.php',
|
||||
'HeraldTranscriptGarbageCollector' => 'applications/herald/garbagecollector/HeraldTranscriptGarbageCollector.php',
|
||||
'HeraldTranscriptListController' => 'applications/herald/controller/HeraldTranscriptListController.php',
|
||||
'HeraldTranscriptPHIDType' => 'applications/herald/phid/HeraldTranscriptPHIDType.php',
|
||||
'HeraldTranscriptQuery' => 'applications/herald/query/HeraldTranscriptQuery.php',
|
||||
'HeraldTranscriptSearchEngine' => 'applications/herald/query/HeraldTranscriptSearchEngine.php',
|
||||
'HeraldTranscriptTestCase' => 'applications/herald/storage/__tests__/HeraldTranscriptTestCase.php',
|
||||
|
@ -5297,6 +5298,7 @@ phutil_register_library_map(array(
|
|||
'HeraldTranscriptDestructionEngineExtension' => 'PhabricatorDestructionEngineExtension',
|
||||
'HeraldTranscriptGarbageCollector' => 'PhabricatorGarbageCollector',
|
||||
'HeraldTranscriptListController' => 'HeraldController',
|
||||
'HeraldTranscriptPHIDType' => 'PhabricatorPHIDType',
|
||||
'HeraldTranscriptQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'HeraldTranscriptSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'HeraldTranscriptTestCase' => 'PhabricatorTestCase',
|
||||
|
|
42
src/applications/herald/phid/HeraldTranscriptPHIDType.php
Normal file
42
src/applications/herald/phid/HeraldTranscriptPHIDType.php
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
final class HeraldTranscriptPHIDType extends PhabricatorPHIDType {
|
||||
|
||||
const TYPECONST = 'HLXS';
|
||||
|
||||
public function getTypeName() {
|
||||
return pht('Herald Transcript');
|
||||
}
|
||||
|
||||
public function newObject() {
|
||||
return new HeraldTranscript();
|
||||
}
|
||||
|
||||
public function getPHIDTypeApplicationClass() {
|
||||
return 'PhabricatorHeraldApplication';
|
||||
}
|
||||
|
||||
protected function buildQueryForObjects(
|
||||
PhabricatorObjectQuery $query,
|
||||
array $phids) {
|
||||
|
||||
return id(new HeraldTranscriptQuery())
|
||||
->withPHIDs($phids);
|
||||
}
|
||||
|
||||
public function loadHandles(
|
||||
PhabricatorHandleQuery $query,
|
||||
array $handles,
|
||||
array $objects) {
|
||||
|
||||
foreach ($handles as $phid => $handle) {
|
||||
$xscript = $objects[$phid];
|
||||
|
||||
$id = $xscript->getID();
|
||||
|
||||
$handle->setName(pht('Transcript %s', $id));
|
||||
$handle->setURI("/herald/transcript/${id}/");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ final class HeraldTranscriptQuery
|
|||
extends PhabricatorCursorPagedPolicyAwareQuery {
|
||||
|
||||
private $ids;
|
||||
private $phids;
|
||||
private $objectPHIDs;
|
||||
private $needPartialRecords;
|
||||
|
||||
|
@ -12,6 +13,11 @@ final class HeraldTranscriptQuery
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function withPHIDs(array $phids) {
|
||||
$this->phids = $phids;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withObjectPHIDs(array $phids) {
|
||||
$this->objectPHIDs = $phids;
|
||||
return $this;
|
||||
|
@ -95,6 +101,13 @@ final class HeraldTranscriptQuery
|
|||
$this->ids);
|
||||
}
|
||||
|
||||
if ($this->phids) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'phid IN (%Ls)',
|
||||
$this->phids);
|
||||
}
|
||||
|
||||
if ($this->objectPHIDs) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
|
|
|
@ -190,7 +190,8 @@ final class HeraldTranscript extends HeraldDAO
|
|||
}
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID('HLXS');
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
HeraldTranscriptPHIDType::TYPECONST);
|
||||
}
|
||||
|
||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||
|
|
Loading…
Reference in a new issue