Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / spaces / searchfield / PhabricatorSpacesSearchField.php
blob526103a0c22d3564ef806203eb616cc77ced0d42
1 <?php
3 final class PhabricatorSpacesSearchField
4 extends PhabricatorSearchTokenizerField {
6 protected function getDefaultValue() {
7 return array();
10 protected function newDatasource() {
11 return new PhabricatorSpacesNamespaceDatasource();
14 protected function getValueFromRequest(AphrontRequest $request, $key) {
15 $viewer = $this->getViewer();
16 $list = $this->getListFromRequest($request, $key);
18 $type = new PhabricatorSpacesNamespacePHIDType();
19 $phids = array();
20 $names = array();
21 foreach ($list as $item) {
22 if ($type->canLoadNamedObject($item)) {
23 $names[] = $item;
24 } else {
25 $phids[] = $item;
29 if ($names) {
30 $spaces = id(new PhabricatorObjectQuery())
31 ->setViewer($viewer)
32 ->withNames($names)
33 ->execute();
34 foreach (mpull($spaces, 'getPHID') as $phid) {
35 $phids[] = $phid;
37 $phids = array_unique($phids);
40 return $phids;
43 protected function newConduitParameterType() {
44 return new ConduitPHIDListParameterType();