1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-25 06:50:55 +01:00

Modernize ProjectQuery paging/ordering

Summary: Ref T7803. Move ProjectQuery off getReversePaging() / getPagingColumn() and onto order vectors.

Test Plan: Set project page size to 3 and paged back and forth.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T7803

Differential Revision: https://secure.phabricator.com/D12357
This commit is contained in:
epriestley 2015-04-11 19:07:28 -07:00
parent 4fba6e7730
commit d496f4d28c

View file

@ -95,18 +95,32 @@ final class PhabricatorProjectQuery
return $this; return $this;
} }
protected function getPagingColumn() { protected function getDefaultOrderVector() {
return 'name'; return array('name');
}
public function getOrderableColumns() {
return array(
'name' => array(
'table' => $this->getPrimaryTableAlias(),
'column' => 'name',
'reverse' => true,
'type' => 'string',
'unique' => true,
),
);
}
protected function getPagingValueMap($cursor, array $keys) {
return array(
'name' => $cursor,
);
} }
protected function getPagingValue($result) { protected function getPagingValue($result) {
return $result->getName(); return $result->getName();
} }
protected function getReversePaging() {
return true;
}
protected function loadPage() { protected function loadPage() {
$table = new PhabricatorProject(); $table = new PhabricatorProject();
$conn_r = $table->establishConnection('r'); $conn_r = $table->establishConnection('r');