Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / calendar / query / PhabricatorCalendarEventInviteeQuery.php
blob683d6cd91800d790708a7cd583f8d498e1724fe1
1 <?php
3 final class PhabricatorCalendarEventInviteeQuery
4 extends PhabricatorCursorPagedPolicyAwareQuery {
6 private $ids;
7 private $eventPHIDs;
8 private $inviteePHIDs;
9 private $inviterPHIDs;
10 private $statuses;
12 public function withIDs(array $ids) {
13 $this->ids = $ids;
14 return $this;
17 public function withEventPHIDs(array $phids) {
18 $this->eventPHIDs = $phids;
19 return $this;
22 public function withInviteePHIDs(array $phids) {
23 $this->inviteePHIDs = $phids;
24 return $this;
27 public function withInviterPHIDs(array $phids) {
28 $this->inviterPHIDs = $phids;
29 return $this;
32 public function withStatuses(array $statuses) {
33 $this->statuses = $statuses;
34 return $this;
37 protected function loadPage() {
38 $table = new PhabricatorCalendarEventInvitee();
39 $conn_r = $table->establishConnection('r');
41 $data = queryfx_all(
42 $conn_r,
43 'SELECT * FROM %T %Q %Q %Q',
44 $table->getTableName(),
45 $this->buildWhereClause($conn_r),
46 $this->buildOrderClause($conn_r),
47 $this->buildLimitClause($conn_r));
49 return $table->loadAllFromArray($data);
52 protected function buildWhereClause(AphrontDatabaseConnection $conn) {
53 $where = array();
55 if ($this->ids !== null) {
56 $where[] = qsprintf(
57 $conn,
58 'id IN (%Ld)',
59 $this->ids);
62 if ($this->eventPHIDs !== null) {
63 $where[] = qsprintf(
64 $conn,
65 'eventPHID IN (%Ls)',
66 $this->eventPHIDs);
69 if ($this->inviteePHIDs !== null) {
70 $where[] = qsprintf(
71 $conn,
72 'inviteePHID IN (%Ls)',
73 $this->inviteePHIDs);
76 if ($this->inviterPHIDs !== null) {
77 $where[] = qsprintf(
78 $conn,
79 'inviterPHID IN (%Ls)',
80 $this->inviterPHIDs);
83 if ($this->statuses !== null) {
84 $where[] = qsprintf(
85 $conn,
86 'status = %d',
87 $this->statuses);
90 $where[] = $this->buildPagingClause($conn);
92 return $this->formatWhereClause($conn, $where);
95 public function getQueryApplicationClass() {
96 return 'PhabricatorCalendarApplication';