@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
3final class FundInitiativeQuery
4 extends PhabricatorCursorPagedPolicyAwareQuery {
5
6 private $ids;
7 private $phids;
8 private $ownerPHIDs;
9 private $statuses;
10
11 public function withIDs(array $ids) {
12 $this->ids = $ids;
13 return $this;
14 }
15
16 public function withPHIDs(array $phids) {
17 $this->phids = $phids;
18 return $this;
19 }
20
21 public function withOwnerPHIDs(array $phids) {
22 $this->ownerPHIDs = $phids;
23 return $this;
24 }
25
26 public function withStatuses(array $statuses) {
27 $this->statuses = $statuses;
28 return $this;
29 }
30
31 public function newResultObject() {
32 return new FundInitiative();
33 }
34
35 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
36 $where = parent::buildWhereClauseParts($conn);
37
38 if ($this->ids !== null) {
39 $where[] = qsprintf(
40 $conn,
41 'i.id IN (%Ld)',
42 $this->ids);
43 }
44
45 if ($this->phids !== null) {
46 $where[] = qsprintf(
47 $conn,
48 'i.phid IN (%Ls)',
49 $this->phids);
50 }
51
52 if ($this->ownerPHIDs !== null) {
53 $where[] = qsprintf(
54 $conn,
55 'i.ownerPHID IN (%Ls)',
56 $this->ownerPHIDs);
57 }
58
59 if ($this->statuses !== null) {
60 $where[] = qsprintf(
61 $conn,
62 'i.status IN (%Ls)',
63 $this->statuses);
64 }
65
66 return $where;
67 }
68
69 public function getQueryApplicationClass() {
70 return PhabricatorFundApplication::class;
71 }
72
73 protected function getPrimaryTableAlias() {
74 return 'i';
75 }
76
77}