Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/oauthserver/query/PhabricatorOAuthServerClientQuery.php
12242 views
1
<?php
2
3
final class PhabricatorOAuthServerClientQuery
4
extends PhabricatorCursorPagedPolicyAwareQuery {
5
6
private $ids;
7
private $phids;
8
private $creatorPHIDs;
9
10
public function withIDs(array $ids) {
11
$this->ids = $ids;
12
return $this;
13
}
14
15
public function withPHIDs(array $phids) {
16
$this->phids = $phids;
17
return $this;
18
}
19
20
public function withCreatorPHIDs(array $phids) {
21
$this->creatorPHIDs = $phids;
22
return $this;
23
}
24
25
protected function loadPage() {
26
$table = new PhabricatorOAuthServerClient();
27
$conn_r = $table->establishConnection('r');
28
29
$data = queryfx_all(
30
$conn_r,
31
'SELECT * FROM %T client %Q %Q %Q',
32
$table->getTableName(),
33
$this->buildWhereClause($conn_r),
34
$this->buildOrderClause($conn_r),
35
$this->buildLimitClause($conn_r));
36
37
return $table->loadAllFromArray($data);
38
}
39
40
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
41
$where = array();
42
43
if ($this->ids) {
44
$where[] = qsprintf(
45
$conn,
46
'id IN (%Ld)',
47
$this->ids);
48
}
49
50
if ($this->phids) {
51
$where[] = qsprintf(
52
$conn,
53
'phid IN (%Ls)',
54
$this->phids);
55
}
56
57
if ($this->creatorPHIDs) {
58
$where[] = qsprintf(
59
$conn,
60
'creatorPHID IN (%Ls)',
61
$this->creatorPHIDs);
62
}
63
64
$where[] = $this->buildPagingClause($conn);
65
66
return $this->formatWhereClause($conn, $where);
67
}
68
69
public function getQueryApplicationClass() {
70
return 'PhabricatorOAuthServerApplication';
71
}
72
73
}
74
75