1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Modernize Nuance queries and search engines

Summary: Ref T10537. Minor updates to simplify and modernize these codepaths.

Test Plan: Searched for queues and sources.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10537

Differential Revision: https://secure.phabricator.com/D15429
This commit is contained in:
epriestley 2016-03-07 15:24:59 -08:00
parent 98542637a1
commit 01ed526527
5 changed files with 24 additions and 48 deletions

View file

@ -15,10 +15,6 @@ final class AlmanacServiceSearchEngine
return new AlmanacServiceQuery();
}
public function newResultObject() {
return new AlmanacService();
}
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();

View file

@ -16,20 +16,12 @@ final class NuanceQueueQuery
return $this;
}
public function newResultObject() {
return new NuanceQueue();
}
protected function loadPage() {
$table = new NuanceQueue();
$conn = $table->establishConnection('r');
$data = queryfx_all(
$conn,
'%Q FROM %T %Q %Q %Q',
$this->buildSelectClause($conn),
$table->getTableName(),
$this->buildWhereClause($conn),
$this->buildOrderClause($conn),
$this->buildLimitClause($conn));
return $table->loadAllFromArray($data);
return $this->loadStandardPage($this->newResultObject());
}
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {

View file

@ -11,21 +11,19 @@ final class NuanceQueueSearchEngine
return pht('Nuance Queues');
}
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
return $saved;
public function newQuery() {
return new NuanceQueueQuery();
}
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
$query = id(new NuanceQueueQuery());
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
return $query;
}
public function buildSearchForm(
AphrontFormView $form,
PhabricatorSavedQuery $saved_query) {}
protected function buildCustomSearchFields() {
return array();
}
protected function getURI($path) {
return '/nuance/queue/'.$path;

View file

@ -22,20 +22,12 @@ final class NuanceSourceQuery
return $this;
}
public function newResultObject() {
return new NuanceSource();
}
protected function loadPage() {
$table = new NuanceSource();
$conn = $table->establishConnection('r');
$data = queryfx_all(
$conn,
'%Q FROM %T %Q %Q %Q',
$this->buildSelectClause($conn),
$table->getTableName(),
$this->buildWhereClause($conn),
$this->buildOrderClause($conn),
$this->buildLimitClause($conn));
return $table->loadAllFromArray($data);
return $this->loadStandardPage($this->newResultObject());
}
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {

View file

@ -11,21 +11,19 @@ final class NuanceSourceSearchEngine
return pht('Nuance Sources');
}
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
return $saved;
public function newQuery() {
return new NuanceSourceQuery();
}
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
$query = id(new NuanceSourceQuery());
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
return $query;
}
public function buildSearchForm(
AphrontFormView $form,
PhabricatorSavedQuery $saved_query) {}
protected function buildCustomSearchFields() {
return array();
}
protected function getURI($path) {
return '/nuance/source/'.$path;