1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 18:22:41 +01:00

Slightly modernize PholioImageQuery

Summary:
Ref T11351. My end goal is to remove `applyInitialEffects()` from Pholio to clear the way for D19897.

Start with some query modernization.

Test Plan: Browsed Pholio, nothing appeared to have changed.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T11351

Differential Revision: https://secure.phabricator.com/D19910
This commit is contained in:
epriestley 2018-12-18 15:14:44 -08:00
parent 95ea4f11b9
commit 38083f6f9e

View file

@ -44,43 +44,32 @@ final class PholioImageQuery
return $this->mockCache; return $this->mockCache;
} }
protected function loadPage() { public function newResultObject() {
$table = new PholioImage(); return new PholioImage();
$conn_r = $table->establishConnection('r');
$data = queryfx_all(
$conn_r,
'SELECT * FROM %T %Q %Q %Q',
$table->getTableName(),
$this->buildWhereClause($conn_r),
$this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r));
$images = $table->loadAllFromArray($data);
return $images;
} }
protected function buildWhereClause(AphrontDatabaseConnection $conn) { protected function loadPage() {
$where = array(); return $this->loadStandardPage($this->newResultObject());
}
$where[] = $this->buildPagingClause($conn); protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
$where = parent::buildWhereClauseParts($conn);
if ($this->ids) { if ($this->ids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn, $conn,
'id IN (%Ld)', 'id IN (%Ld)',
$this->ids); $this->ids);
} }
if ($this->phids) { if ($this->phids !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn, $conn,
'phid IN (%Ls)', 'phid IN (%Ls)',
$this->phids); $this->phids);
} }
if ($this->mockIDs) { if ($this->mockIDs !== null) {
$where[] = qsprintf( $where[] = qsprintf(
$conn, $conn,
'mockID IN (%Ld)', 'mockID IN (%Ld)',
@ -94,7 +83,7 @@ final class PholioImageQuery
$this->obsolete); $this->obsolete);
} }
return $this->formatWhereClause($conn, $where); return $where;
} }
protected function willFilterPage(array $images) { protected function willFilterPage(array $images) {