@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3/**
4 * @extends PhabricatorCursorPagedPolicyAwareQuery<PhabricatorNamedQuery>
5 */
6final class PhabricatorNamedQueryQuery
7 extends PhabricatorCursorPagedPolicyAwareQuery {
8
9 private $ids;
10 private $engineClassNames;
11 private $userPHIDs;
12 private $queryKeys;
13
14 public function withIDs(array $ids) {
15 $this->ids = $ids;
16 return $this;
17 }
18
19 public function withUserPHIDs(array $user_phids) {
20 $this->userPHIDs = $user_phids;
21 return $this;
22 }
23
24 public function withEngineClassNames(array $engine_class_names) {
25 $this->engineClassNames = $engine_class_names;
26 return $this;
27 }
28
29 public function withQueryKeys(array $query_keys) {
30 $this->queryKeys = $query_keys;
31 return $this;
32 }
33
34 public function newResultObject() {
35 return new PhabricatorNamedQuery();
36 }
37
38 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
39 $where = parent::buildWhereClauseParts($conn);
40
41 if ($this->ids !== null) {
42 $where[] = qsprintf(
43 $conn,
44 'id IN (%Ld)',
45 $this->ids);
46 }
47
48 if ($this->engineClassNames !== null) {
49 $where[] = qsprintf(
50 $conn,
51 'engineClassName IN (%Ls)',
52 $this->engineClassNames);
53 }
54
55 if ($this->userPHIDs !== null) {
56 $where[] = qsprintf(
57 $conn,
58 'userPHID IN (%Ls)',
59 $this->userPHIDs);
60 }
61
62 if ($this->queryKeys !== null) {
63 $where[] = qsprintf(
64 $conn,
65 'queryKey IN (%Ls)',
66 $this->queryKeys);
67 }
68
69 return $where;
70 }
71
72 public function getQueryApplicationClass() {
73 return PhabricatorSearchApplication::class;
74 }
75
76}