Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / almanac / query / AlmanacNetworkQuery.php
blob7af9db858530f5cabed4680448f2ef3e8518dd24
1 <?php
3 final class AlmanacNetworkQuery
4 extends AlmanacQuery {
6 private $ids;
7 private $phids;
8 private $names;
10 public function withIDs(array $ids) {
11 $this->ids = $ids;
12 return $this;
15 public function withPHIDs(array $phids) {
16 $this->phids = $phids;
17 return $this;
20 public function newResultObject() {
21 return new AlmanacNetwork();
24 public function withNames(array $names) {
25 $this->names = $names;
26 return $this;
29 public function withNameNgrams($ngrams) {
30 return $this->withNgramsConstraint(
31 new AlmanacNetworkNameNgrams(),
32 $ngrams);
35 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
36 $where = parent::buildWhereClauseParts($conn);
38 if ($this->ids !== null) {
39 $where[] = qsprintf(
40 $conn,
41 'network.id IN (%Ld)',
42 $this->ids);
45 if ($this->phids !== null) {
46 $where[] = qsprintf(
47 $conn,
48 'network.phid IN (%Ls)',
49 $this->phids);
52 if ($this->names !== null) {
53 $where[] = qsprintf(
54 $conn,
55 'network.name IN (%Ls)',
56 $this->names);
59 return $where;
62 protected function getPrimaryTableAlias() {
63 return 'network';
66 public function getQueryApplicationClass() {
67 return 'PhabricatorAlmanacApplication';