1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

Use application PHIDs for ATOM

Summary: Ref T2715.

Test Plan: `phid.query`

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2715

Differential Revision: https://secure.phabricator.com/D6597
This commit is contained in:
epriestley 2013-07-30 06:49:13 -07:00
parent bdc93f65a2
commit 8d21dc0d52
4 changed files with 45 additions and 2 deletions

View file

@ -533,6 +533,7 @@ phutil_register_library_map(array(
'DivinerLiveBook' => 'applications/diviner/storage/DivinerLiveBook.php',
'DivinerLivePublisher' => 'applications/diviner/publisher/DivinerLivePublisher.php',
'DivinerLiveSymbol' => 'applications/diviner/storage/DivinerLiveSymbol.php',
'DivinerPHIDTypeAtom' => 'applications/diviner/phid/DivinerPHIDTypeAtom.php',
'DivinerPHIDTypeBook' => 'applications/diviner/phid/DivinerPHIDTypeBook.php',
'DivinerPublishCache' => 'applications/diviner/cache/DivinerPublishCache.php',
'DivinerPublisher' => 'applications/diviner/publisher/DivinerPublisher.php',
@ -2537,6 +2538,7 @@ phutil_register_library_map(array(
1 => 'PhabricatorPolicyInterface',
2 => 'PhabricatorMarkupInterface',
),
'DivinerPHIDTypeAtom' => 'PhabricatorPHIDType',
'DivinerPHIDTypeBook' => 'PhabricatorPHIDType',
'DivinerPublishCache' => 'DivinerDiskCache',
'DivinerRemarkupRuleSymbol' => 'PhutilRemarkupRule',

View file

@ -0,0 +1,42 @@
<?php
final class DivinerPHIDTypeAtom extends PhabricatorPHIDType {
const TYPECONST = 'ATOM';
public function getTypeConstant() {
return self::TYPECONST;
}
public function getTypeName() {
return pht('Atom');
}
public function newObject() {
return new DivinerLiveSymbol();
}
public function loadObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new DivinerAtomQuery())
->setViewer($query->getViewer())
->withPHIDs($phids)
->execute();
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$atom = $objects[$phid];
$handle->setName($atom->getTitle());
$handle->setURI($atom->getName());
}
}
}

View file

@ -29,7 +29,7 @@ final class DivinerLiveSymbol extends DivinerDAO
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_ATOM);
DivinerPHIDTypeAtom::TYPECONST);
}
public function getBook() {

View file

@ -22,7 +22,6 @@ final class PhabricatorPHIDConstants {
const PHID_TYPE_XCMT = 'XCMT';
const PHID_TYPE_ATOM = 'ATOM';
const PHID_TYPE_AUTH = 'AUTH';
const PHID_TYPE_XOBJ = 'XOBJ';