@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<PhabricatorAuthContactNumber>
5 */
6final class PhabricatorAuthContactNumberQuery
7 extends PhabricatorCursorPagedPolicyAwareQuery {
8
9 private $ids;
10 private $phids;
11 private $objectPHIDs;
12 private $statuses;
13 private $uniqueKeys;
14 private $isPrimary;
15
16 public function withIDs(array $ids) {
17 $this->ids = $ids;
18 return $this;
19 }
20
21 public function withPHIDs(array $phids) {
22 $this->phids = $phids;
23 return $this;
24 }
25
26 public function withObjectPHIDs(array $object_phids) {
27 $this->objectPHIDs = $object_phids;
28 return $this;
29 }
30
31 public function withStatuses(array $statuses) {
32 $this->statuses = $statuses;
33 return $this;
34 }
35
36 public function withUniqueKeys(array $unique_keys) {
37 $this->uniqueKeys = $unique_keys;
38 return $this;
39 }
40
41 public function withIsPrimary($is_primary) {
42 $this->isPrimary = $is_primary;
43 return $this;
44 }
45
46 public function newResultObject() {
47 return new PhabricatorAuthContactNumber();
48 }
49
50 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
51 $where = parent::buildWhereClauseParts($conn);
52
53 if ($this->ids !== null) {
54 $where[] = qsprintf(
55 $conn,
56 'id IN (%Ld)',
57 $this->ids);
58 }
59
60 if ($this->phids !== null) {
61 $where[] = qsprintf(
62 $conn,
63 'phid IN (%Ls)',
64 $this->phids);
65 }
66
67 if ($this->objectPHIDs !== null) {
68 $where[] = qsprintf(
69 $conn,
70 'objectPHID IN (%Ls)',
71 $this->objectPHIDs);
72 }
73
74 if ($this->statuses !== null) {
75 $where[] = qsprintf(
76 $conn,
77 'status IN (%Ls)',
78 $this->statuses);
79 }
80
81 if ($this->uniqueKeys !== null) {
82 $where[] = qsprintf(
83 $conn,
84 'uniqueKey IN (%Ls)',
85 $this->uniqueKeys);
86 }
87
88 if ($this->isPrimary !== null) {
89 $where[] = qsprintf(
90 $conn,
91 'isPrimary = %d',
92 (int)$this->isPrimary);
93 }
94
95 return $where;
96 }
97
98 public function getQueryApplicationClass() {
99 return PhabricatorAuthApplication::class;
100 }
101
102}