mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
Fix some "%Q" behavior in PhortuneMerchantQuery
Summary: Ref T13217. This older query does some manual joins; update it for more modern joins. Test Plan: Ran `instances/` unit tests and got a clean result, browsed Phortune merchants. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13217 Differential Revision: https://secure.phabricator.com/D19820
This commit is contained in:
parent
9481b9eff1
commit
4967cd6ab9
1 changed files with 15 additions and 21 deletions
|
@ -28,20 +28,12 @@ final class PhortuneMerchantQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function newResultObject() {
|
||||||
|
return new PhortuneMerchant();
|
||||||
|
}
|
||||||
|
|
||||||
protected function loadPage() {
|
protected function loadPage() {
|
||||||
$table = new PhortuneMerchant();
|
return $this->loadStandardPage($this->newResultObject());
|
||||||
$conn = $table->establishConnection('r');
|
|
||||||
|
|
||||||
$rows = queryfx_all(
|
|
||||||
$conn,
|
|
||||||
'SELECT m.* FROM %T m %Q %Q %Q %Q',
|
|
||||||
$table->getTableName(),
|
|
||||||
$this->buildJoinClause($conn),
|
|
||||||
$this->buildWhereClause($conn),
|
|
||||||
$this->buildOrderClause($conn),
|
|
||||||
$this->buildLimitClause($conn));
|
|
||||||
|
|
||||||
return $table->loadAllFromArray($rows);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function willFilterPage(array $merchants) {
|
protected function willFilterPage(array $merchants) {
|
||||||
|
@ -88,8 +80,8 @@ final class PhortuneMerchantQuery
|
||||||
return $merchants;
|
return $merchants;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildWhereClause(AphrontDatabaseConnection $conn) {
|
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
|
||||||
$where = array();
|
$where = parent::buildWhereClauseParts($conn);
|
||||||
|
|
||||||
if ($this->ids !== null) {
|
if ($this->ids !== null) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
|
@ -112,13 +104,11 @@ final class PhortuneMerchantQuery
|
||||||
$this->memberPHIDs);
|
$this->memberPHIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
$where[] = $this->buildPagingClause($conn);
|
return $where;
|
||||||
|
|
||||||
return $this->formatWhereClause($conn, $where);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildJoinClause(AphrontDatabaseConnection $conn) {
|
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) {
|
||||||
$joins = array();
|
$joins = parent::buildJoinClauseParts($conn);
|
||||||
|
|
||||||
if ($this->memberPHIDs !== null) {
|
if ($this->memberPHIDs !== null) {
|
||||||
$joins[] = qsprintf(
|
$joins[] = qsprintf(
|
||||||
|
@ -128,11 +118,15 @@ final class PhortuneMerchantQuery
|
||||||
PhortuneMerchantHasMemberEdgeType::EDGECONST);
|
PhortuneMerchantHasMemberEdgeType::EDGECONST);
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(' ', $joins);
|
return $joins;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryApplicationClass() {
|
public function getQueryApplicationClass() {
|
||||||
return 'PhabricatorPhortuneApplication';
|
return 'PhabricatorPhortuneApplication';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getPrimaryTableAlias() {
|
||||||
|
return 'm';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue