mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 15:22:41 +01:00
Use application PHIDs for Diviner Books
Summary: Ref T2715. Test Plan: `phid.query` Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2715 Differential Revision: https://secure.phabricator.com/D6596
This commit is contained in:
parent
8e1dd430fd
commit
bdc93f65a2
4 changed files with 48 additions and 2 deletions
|
@ -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',
|
||||
'DivinerPHIDTypeBook' => 'applications/diviner/phid/DivinerPHIDTypeBook.php',
|
||||
'DivinerPublishCache' => 'applications/diviner/cache/DivinerPublishCache.php',
|
||||
'DivinerPublisher' => 'applications/diviner/publisher/DivinerPublisher.php',
|
||||
'DivinerRemarkupRuleSymbol' => 'applications/diviner/markup/DivinerRemarkupRuleSymbol.php',
|
||||
|
@ -2536,6 +2537,7 @@ phutil_register_library_map(array(
|
|||
1 => 'PhabricatorPolicyInterface',
|
||||
2 => 'PhabricatorMarkupInterface',
|
||||
),
|
||||
'DivinerPHIDTypeBook' => 'PhabricatorPHIDType',
|
||||
'DivinerPublishCache' => 'DivinerDiskCache',
|
||||
'DivinerRemarkupRuleSymbol' => 'PhutilRemarkupRule',
|
||||
'DivinerStaticPublisher' => 'DivinerPublisher',
|
||||
|
|
45
src/applications/diviner/phid/DivinerPHIDTypeBook.php
Normal file
45
src/applications/diviner/phid/DivinerPHIDTypeBook.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
final class DivinerPHIDTypeBook extends PhabricatorPHIDType {
|
||||
|
||||
const TYPECONST = 'BOOK';
|
||||
|
||||
public function getTypeConstant() {
|
||||
return self::TYPECONST;
|
||||
}
|
||||
|
||||
public function getTypeName() {
|
||||
return pht('Book');
|
||||
}
|
||||
|
||||
public function newObject() {
|
||||
return new DivinerLiveBook();
|
||||
}
|
||||
|
||||
public function loadObjects(
|
||||
PhabricatorObjectQuery $query,
|
||||
array $phids) {
|
||||
|
||||
return id(new DivinerBookQuery())
|
||||
->setViewer($query->getViewer())
|
||||
->withPHIDs($phids)
|
||||
->execute();
|
||||
}
|
||||
|
||||
public function loadHandles(
|
||||
PhabricatorHandleQuery $query,
|
||||
array $handles,
|
||||
array $objects) {
|
||||
|
||||
foreach ($handles as $phid => $handle) {
|
||||
$book = $objects[$phid];
|
||||
|
||||
$name = $book->getName();
|
||||
|
||||
$handle->setName($book->getShortTitle());
|
||||
$handle->setFullName($book->getTitle());
|
||||
$handle->setURI("/diviner/book/{$name}/");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -28,7 +28,7 @@ final class DivinerLiveBook extends DivinerDAO
|
|||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID(
|
||||
PhabricatorPHIDConstants::PHID_TYPE_BOOK);
|
||||
DivinerPHIDTypeBook::TYPECONST);
|
||||
}
|
||||
|
||||
public function getTitle() {
|
||||
|
|
|
@ -22,7 +22,6 @@ final class PhabricatorPHIDConstants {
|
|||
|
||||
const PHID_TYPE_XCMT = 'XCMT';
|
||||
|
||||
const PHID_TYPE_BOOK = 'BOOK';
|
||||
const PHID_TYPE_ATOM = 'ATOM';
|
||||
const PHID_TYPE_AUTH = 'AUTH';
|
||||
const PHID_TYPE_XOBJ = 'XOBJ';
|
||||
|
|
Loading…
Reference in a new issue