Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/calendar/query/PhabricatorCalendarEventInviteeQuery.php
12256 views
1
<?php
2
3
final class PhabricatorCalendarEventInviteeQuery
4
extends PhabricatorCursorPagedPolicyAwareQuery {
5
6
private $ids;
7
private $eventPHIDs;
8
private $inviteePHIDs;
9
private $inviterPHIDs;
10
private $statuses;
11
12
public function withIDs(array $ids) {
13
$this->ids = $ids;
14
return $this;
15
}
16
17
public function withEventPHIDs(array $phids) {
18
$this->eventPHIDs = $phids;
19
return $this;
20
}
21
22
public function withInviteePHIDs(array $phids) {
23
$this->inviteePHIDs = $phids;
24
return $this;
25
}
26
27
public function withInviterPHIDs(array $phids) {
28
$this->inviterPHIDs = $phids;
29
return $this;
30
}
31
32
public function withStatuses(array $statuses) {
33
$this->statuses = $statuses;
34
return $this;
35
}
36
37
protected function loadPage() {
38
$table = new PhabricatorCalendarEventInvitee();
39
$conn_r = $table->establishConnection('r');
40
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));
48
49
return $table->loadAllFromArray($data);
50
}
51
52
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
53
$where = array();
54
55
if ($this->ids !== null) {
56
$where[] = qsprintf(
57
$conn,
58
'id IN (%Ld)',
59
$this->ids);
60
}
61
62
if ($this->eventPHIDs !== null) {
63
$where[] = qsprintf(
64
$conn,
65
'eventPHID IN (%Ls)',
66
$this->eventPHIDs);
67
}
68
69
if ($this->inviteePHIDs !== null) {
70
$where[] = qsprintf(
71
$conn,
72
'inviteePHID IN (%Ls)',
73
$this->inviteePHIDs);
74
}
75
76
if ($this->inviterPHIDs !== null) {
77
$where[] = qsprintf(
78
$conn,
79
'inviterPHID IN (%Ls)',
80
$this->inviterPHIDs);
81
}
82
83
if ($this->statuses !== null) {
84
$where[] = qsprintf(
85
$conn,
86
'status = %d',
87
$this->statuses);
88
}
89
90
$where[] = $this->buildPagingClause($conn);
91
92
return $this->formatWhereClause($conn, $where);
93
}
94
95
public function getQueryApplicationClass() {
96
return 'PhabricatorCalendarApplication';
97
}
98
99
}
100
101