@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<PhabricatorCalendarExport>
5 */
6final class PhabricatorCalendarExportQuery
7 extends PhabricatorCursorPagedPolicyAwareQuery {
8
9 private $ids;
10 private $phids;
11 private $authorPHIDs;
12 private $secretKeys;
13 private $isDisabled;
14
15 public function withIDs(array $ids) {
16 $this->ids = $ids;
17 return $this;
18 }
19
20 public function withPHIDs(array $phids) {
21 $this->phids = $phids;
22 return $this;
23 }
24
25 public function withAuthorPHIDs(array $phids) {
26 $this->authorPHIDs = $phids;
27 return $this;
28 }
29
30 public function withIsDisabled($is_disabled) {
31 $this->isDisabled = $is_disabled;
32 return $this;
33 }
34
35 public function withSecretKeys(array $keys) {
36 $this->secretKeys = $keys;
37 return $this;
38 }
39
40 public function newResultObject() {
41 return new PhabricatorCalendarExport();
42 }
43
44 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
45 $where = parent::buildWhereClauseParts($conn);
46
47 if ($this->ids !== null) {
48 $where[] = qsprintf(
49 $conn,
50 'export.id IN (%Ld)',
51 $this->ids);
52 }
53
54 if ($this->phids !== null) {
55 $where[] = qsprintf(
56 $conn,
57 'export.phid IN (%Ls)',
58 $this->phids);
59 }
60
61 if ($this->authorPHIDs !== null) {
62 $where[] = qsprintf(
63 $conn,
64 'export.authorPHID IN (%Ls)',
65 $this->authorPHIDs);
66 }
67
68 if ($this->isDisabled !== null) {
69 $where[] = qsprintf(
70 $conn,
71 'export.isDisabled = %d',
72 (int)$this->isDisabled);
73 }
74
75 if ($this->secretKeys !== null) {
76 $where[] = qsprintf(
77 $conn,
78 'export.secretKey IN (%Ls)',
79 $this->secretKeys);
80 }
81
82 return $where;
83 }
84
85 protected function getPrimaryTableAlias() {
86 return 'export';
87 }
88
89 public function getQueryApplicationClass() {
90 return PhabricatorCalendarApplication::class;
91 }
92
93}