Path: blob/master/src/applications/almanac/query/AlmanacBindingSearchEngine.php
12256 views
<?php12final class AlmanacBindingSearchEngine3extends PhabricatorApplicationSearchEngine {45public function getResultTypeDescription() {6return pht('Almanac Bindings');7}89public function getApplicationClassName() {10return 'PhabricatorAlmanacApplication';11}1213public function newQuery() {14return new AlmanacBindingQuery();15}1617protected function buildCustomSearchFields() {18return array(19id(new PhabricatorPHIDsSearchField())20->setLabel(pht('Services'))21->setKey('servicePHIDs')22->setAliases(array('service', 'servicePHID', 'services'))23->setDescription(pht('Search for bindings on particular services.')),24id(new PhabricatorPHIDsSearchField())25->setLabel(pht('Devices'))26->setKey('devicePHIDs')27->setAliases(array('device', 'devicePHID', 'devices'))28->setDescription(pht('Search for bindings on particular devices.')),29);30}3132protected function buildQueryFromParameters(array $map) {33$query = $this->newQuery();3435if ($map['servicePHIDs']) {36$query->withServicePHIDs($map['servicePHIDs']);37}3839if ($map['devicePHIDs']) {40$query->withDevicePHIDs($map['devicePHIDs']);41}4243return $query;44}4546protected function getURI($path) {47return '/almanac/binding/'.$path;48}4950protected function getBuiltinQueryNames() {51$names = array(52'all' => pht('All Bindings'),53);5455return $names;56}5758public function buildSavedQueryFromBuiltin($query_key) {59$query = $this->newSavedQuery();60$query->setQueryKey($query_key);6162switch ($query_key) {63case 'all':64return $query;65}6667return parent::buildSavedQueryFromBuiltin($query_key);68}6970protected function renderResultList(71array $devices,72PhabricatorSavedQuery $query,73array $handles) {7475// For now, this SearchEngine just supports API access via Conduit.76throw new PhutilMethodNotImplementedException();77}7879}808182