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