@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<PhabricatorNamedQueryConfig>
5 */
6final class PhabricatorNamedQueryConfigQuery
7 extends PhabricatorCursorPagedPolicyAwareQuery {
8
9 private $ids;
10 private $engineClassNames;
11 private $scopePHIDs;
12
13 public function withIDs(array $ids) {
14 $this->ids = $ids;
15 return $this;
16 }
17
18 public function withScopePHIDs(array $scope_phids) {
19 $this->scopePHIDs = $scope_phids;
20 return $this;
21 }
22
23 public function withEngineClassNames(array $engine_class_names) {
24 $this->engineClassNames = $engine_class_names;
25 return $this;
26 }
27
28 public function newResultObject() {
29 return new PhabricatorNamedQueryConfig();
30 }
31
32 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
33 $where = parent::buildWhereClauseParts($conn);
34
35 if ($this->ids !== null) {
36 $where[] = qsprintf(
37 $conn,
38 'id IN (%Ld)',
39 $this->ids);
40 }
41
42 if ($this->engineClassNames !== null) {
43 $where[] = qsprintf(
44 $conn,
45 'engineClassName IN (%Ls)',
46 $this->engineClassNames);
47 }
48
49 if ($this->scopePHIDs !== null) {
50 $where[] = qsprintf(
51 $conn,
52 'scopePHID IN (%Ls)',
53 $this->scopePHIDs);
54 }
55
56 return $where;
57 }
58
59 public function getQueryApplicationClass() {
60 return PhabricatorSearchApplication::class;
61 }
62
63}