@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+15 -21
+15 -21
src/applications/phortune/query/PhortuneMerchantQuery.php
··· 28 28 return $this; 29 29 } 30 30 31 - protected function loadPage() { 32 - $table = new PhortuneMerchant(); 33 - $conn = $table->establishConnection('r'); 34 - 35 - $rows = queryfx_all( 36 - $conn, 37 - 'SELECT m.* FROM %T m %Q %Q %Q %Q', 38 - $table->getTableName(), 39 - $this->buildJoinClause($conn), 40 - $this->buildWhereClause($conn), 41 - $this->buildOrderClause($conn), 42 - $this->buildLimitClause($conn)); 31 + public function newResultObject() { 32 + return new PhortuneMerchant(); 33 + } 43 34 44 - return $table->loadAllFromArray($rows); 35 + protected function loadPage() { 36 + return $this->loadStandardPage($this->newResultObject()); 45 37 } 46 38 47 39 protected function willFilterPage(array $merchants) { ··· 88 80 return $merchants; 89 81 } 90 82 91 - protected function buildWhereClause(AphrontDatabaseConnection $conn) { 92 - $where = array(); 83 + protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { 84 + $where = parent::buildWhereClauseParts($conn); 93 85 94 86 if ($this->ids !== null) { 95 87 $where[] = qsprintf( ··· 112 104 $this->memberPHIDs); 113 105 } 114 106 115 - $where[] = $this->buildPagingClause($conn); 116 - 117 - return $this->formatWhereClause($conn, $where); 107 + return $where; 118 108 } 119 109 120 - protected function buildJoinClause(AphrontDatabaseConnection $conn) { 121 - $joins = array(); 110 + protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { 111 + $joins = parent::buildJoinClauseParts($conn); 122 112 123 113 if ($this->memberPHIDs !== null) { 124 114 $joins[] = qsprintf( ··· 128 118 PhortuneMerchantHasMemberEdgeType::EDGECONST); 129 119 } 130 120 131 - return implode(' ', $joins); 121 + return $joins; 132 122 } 133 123 134 124 public function getQueryApplicationClass() { 135 125 return 'PhabricatorPhortuneApplication'; 126 + } 127 + 128 + protected function getPrimaryTableAlias() { 129 + return 'm'; 136 130 } 137 131 138 132 }