Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / almanac / query / AlmanacBindingSearchEngine.php
blobfbeb7644b96871b1679342dc0d0e731561f7d3d6
1 <?php
3 final class AlmanacBindingSearchEngine
4 extends PhabricatorApplicationSearchEngine {
6 public function getResultTypeDescription() {
7 return pht('Almanac Bindings');
10 public function getApplicationClassName() {
11 return 'PhabricatorAlmanacApplication';
14 public function newQuery() {
15 return new AlmanacBindingQuery();
18 protected function buildCustomSearchFields() {
19 return array(
20 id(new PhabricatorPHIDsSearchField())
21 ->setLabel(pht('Services'))
22 ->setKey('servicePHIDs')
23 ->setAliases(array('service', 'servicePHID', 'services'))
24 ->setDescription(pht('Search for bindings on particular services.')),
25 id(new PhabricatorPHIDsSearchField())
26 ->setLabel(pht('Devices'))
27 ->setKey('devicePHIDs')
28 ->setAliases(array('device', 'devicePHID', 'devices'))
29 ->setDescription(pht('Search for bindings on particular devices.')),
33 protected function buildQueryFromParameters(array $map) {
34 $query = $this->newQuery();
36 if ($map['servicePHIDs']) {
37 $query->withServicePHIDs($map['servicePHIDs']);
40 if ($map['devicePHIDs']) {
41 $query->withDevicePHIDs($map['devicePHIDs']);
44 return $query;
47 protected function getURI($path) {
48 return '/almanac/binding/'.$path;
51 protected function getBuiltinQueryNames() {
52 $names = array(
53 'all' => pht('All Bindings'),
56 return $names;
59 public function buildSavedQueryFromBuiltin($query_key) {
60 $query = $this->newSavedQuery();
61 $query->setQueryKey($query_key);
63 switch ($query_key) {
64 case 'all':
65 return $query;
68 return parent::buildSavedQueryFromBuiltin($query_key);
71 protected function renderResultList(
72 array $devices,
73 PhabricatorSavedQuery $query,
74 array $handles) {
76 // For now, this SearchEngine just supports API access via Conduit.
77 throw new PhutilMethodNotImplementedException();