Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/query/AlmanacNetworkQuery.php
Show All 10 Lines | public function withIDs(array $ids) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withPHIDs(array $phids) { | public function withPHIDs(array $phids) { | ||||
$this->phids = $phids; | $this->phids = $phids; | ||||
return $this; | return $this; | ||||
} | } | ||||
protected function loadPage() { | public function newResultObject() { | ||||
$table = new AlmanacNetwork(); | return new AlmanacNetwork(); | ||||
$conn_r = $table->establishConnection('r'); | } | ||||
$data = queryfx_all( | public function withNameNgrams($ngrams) { | ||||
$conn_r, | return $this->withNgramsConstraint( | ||||
'SELECT * FROM %T %Q %Q %Q', | new AlmanacNetworkNameNgrams(), | ||||
$table->getTableName(), | $ngrams); | ||||
$this->buildWhereClause($conn_r), | } | ||||
$this->buildOrderClause($conn_r), | |||||
$this->buildLimitClause($conn_r)); | |||||
return $table->loadAllFromArray($data); | protected function loadPage() { | ||||
return $this->loadStandardPage($this->newResultObject()); | |||||
} | } | ||||
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
$where = array(); | $where = parent::buildWhereClauseParts($conn); | ||||
if ($this->ids !== null) { | if ($this->ids !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'id IN (%Ld)', | 'network.id IN (%Ld)', | ||||
$this->ids); | $this->ids); | ||||
} | } | ||||
if ($this->phids !== null) { | if ($this->phids !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'phid IN (%Ls)', | 'network.phid IN (%Ls)', | ||||
$this->phids); | $this->phids); | ||||
} | } | ||||
$where[] = $this->buildPagingClause($conn_r); | return $where; | ||||
} | |||||
return $this->formatWhereClause($where); | protected function getPrimaryTableAlias() { | ||||
return 'network'; | |||||
} | } | ||||
public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
return 'PhabricatorAlmanacApplication'; | return 'PhabricatorAlmanacApplication'; | ||||
} | } | ||||
} | } |