@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
at recaptime-dev/main 73 lines 1.4 kB view raw
1<?php 2 3/** 4 * @extends AlmanacQuery<AlmanacNetwork> 5 */ 6final class AlmanacNetworkQuery 7 extends AlmanacQuery { 8 9 private $ids; 10 private $phids; 11 private $names; 12 13 public function withIDs(array $ids) { 14 $this->ids = $ids; 15 return $this; 16 } 17 18 public function withPHIDs(array $phids) { 19 $this->phids = $phids; 20 return $this; 21 } 22 23 public function newResultObject() { 24 return new AlmanacNetwork(); 25 } 26 27 public function withNames(array $names) { 28 $this->names = $names; 29 return $this; 30 } 31 32 public function withNameNgrams($ngrams) { 33 return $this->withNgramsConstraint( 34 new AlmanacNetworkNameNgrams(), 35 $ngrams); 36 } 37 38 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 39 $where = parent::buildWhereClauseParts($conn); 40 41 if ($this->ids !== null) { 42 $where[] = qsprintf( 43 $conn, 44 'network.id IN (%Ld)', 45 $this->ids); 46 } 47 48 if ($this->phids !== null) { 49 $where[] = qsprintf( 50 $conn, 51 'network.phid IN (%Ls)', 52 $this->phids); 53 } 54 55 if ($this->names !== null) { 56 $where[] = qsprintf( 57 $conn, 58 'network.name IN (%Ls)', 59 $this->names); 60 } 61 62 return $where; 63 } 64 65 protected function getPrimaryTableAlias() { 66 return 'network'; 67 } 68 69 public function getQueryApplicationClass() { 70 return PhabricatorAlmanacApplication::class; 71 } 72 73}