Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/phid/DivinerBookPHIDType.php
| <?php | <?php | ||||
| final class DivinerBookPHIDType extends PhabricatorPHIDType { | final class DivinerBookPHIDType extends PhabricatorPHIDType { | ||||
| const TYPECONST = 'BOOK'; | const TYPECONST = 'BOOK'; | ||||
| public function getTypeName() { | public function getTypeName() { | ||||
| return pht('Book'); | return pht('Diviner Book'); | ||||
| } | } | ||||
| public function newObject() { | public function newObject() { | ||||
| return new DivinerLiveBook(); | return new DivinerLiveBook(); | ||||
| } | } | ||||
| protected function buildQueryForObjects( | protected function buildQueryForObjects( | ||||
| PhabricatorObjectQuery $query, | PhabricatorObjectQuery $query, | ||||
| array $phids) { | array $phids) { | ||||
| return id(new DivinerBookQuery()) | return id(new DivinerBookQuery()) | ||||
| ->withPHIDs($phids); | ->withPHIDs($phids); | ||||
| } | } | ||||
| public function loadHandles( | public function loadHandles( | ||||
| PhabricatorHandleQuery $query, | PhabricatorHandleQuery $query, | ||||
| array $handles, | array $handles, | ||||
| array $objects) { | array $objects) { | ||||
| foreach ($handles as $phid => $handle) { | foreach ($handles as $phid => $handle) { | ||||
| $book = $objects[$phid]; | $book = $objects[$phid]; | ||||
| $name = $book->getName(); | $name = $book->getName(); | ||||
| $handle->setName($book->getShortTitle()); | $handle | ||||
| $handle->setFullName($book->getTitle()); | ->setName($book->getShortTitle()) | ||||
| $handle->setURI("/diviner/book/{$name}/"); | ->setFullName($book->getTitle()) | ||||
| ->setURI("/book/{$name}/"); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||