Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/phid/DivinerAtomPHIDType.php
| <?php | <?php | ||||
| final class DivinerAtomPHIDType extends PhabricatorPHIDType { | final class DivinerAtomPHIDType extends PhabricatorPHIDType { | ||||
| const TYPECONST = 'ATOM'; | const TYPECONST = 'ATOM'; | ||||
| public function getTypeName() { | public function getTypeName() { | ||||
| return pht('Atom'); | return pht('Diviner Atom'); | ||||
| } | } | ||||
| public function newObject() { | public function newObject() { | ||||
| return new DivinerLiveSymbol(); | return new DivinerLiveSymbol(); | ||||
| } | } | ||||
| protected function buildQueryForObjects( | protected function buildQueryForObjects( | ||||
| PhabricatorObjectQuery $query, | PhabricatorObjectQuery $query, | ||||
| array $phids) { | array $phids) { | ||||
| return id(new DivinerAtomQuery()) | return id(new DivinerAtomQuery()) | ||||
| ->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) { | ||||
| $atom = $objects[$phid]; | $atom = $objects[$phid]; | ||||
| $handle->setName($atom->getTitle()); | $book = $atom->getBook()->getName(); | ||||
| $handle->setURI($atom->getName()); | $name = $atom->getName(); | ||||
| $type = $atom->getType(); | |||||
| $handle | |||||
| ->setName($atom->getName()) | |||||
| ->setTitle($atom->getTitle()) | |||||
| ->setURI("/book/{$book}/{$type}/{$name}/") | |||||
| ->setStatus($atom->getGraphHash() | |||||
| ? PhabricatorObjectHandle::STATUS_OPEN | |||||
| : PhabricatorObjectHandle::STATUS_CLOSED); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||