Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/almanac/query/AlmanacNetworkQuery.php
12256 views
1
<?php
2
3
final class AlmanacNetworkQuery
4
extends AlmanacQuery {
5
6
private $ids;
7
private $phids;
8
private $names;
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 newResultObject() {
21
return new AlmanacNetwork();
22
}
23
24
public function withNames(array $names) {
25
$this->names = $names;
26
return $this;
27
}
28
29
public function withNameNgrams($ngrams) {
30
return $this->withNgramsConstraint(
31
new AlmanacNetworkNameNgrams(),
32
$ngrams);
33
}
34
35
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
36
$where = parent::buildWhereClauseParts($conn);
37
38
if ($this->ids !== null) {
39
$where[] = qsprintf(
40
$conn,
41
'network.id IN (%Ld)',
42
$this->ids);
43
}
44
45
if ($this->phids !== null) {
46
$where[] = qsprintf(
47
$conn,
48
'network.phid IN (%Ls)',
49
$this->phids);
50
}
51
52
if ($this->names !== null) {
53
$where[] = qsprintf(
54
$conn,
55
'network.name IN (%Ls)',
56
$this->names);
57
}
58
59
return $where;
60
}
61
62
protected function getPrimaryTableAlias() {
63
return 'network';
64
}
65
66
public function getQueryApplicationClass() {
67
return 'PhabricatorAlmanacApplication';
68
}
69
70
}
71
72