@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.

Make buildWhereClause() a method of AphrontCursorPagedPolicyAwareQuery

Summary:
Ref T4100. Ref T5595.

To support a unified "Projects:" query across all applications, a future diff is going to add a set of "Edge Logic" capabilities to `PolicyAwareQuery` which write the required SELECT, JOIN, WHERE, HAVING and GROUP clauses for you.

With the addition of "Edge Logic", we'll have three systems which may need to build components of query claues: ordering/paging, customfields/applicationsearch, and edge logic.

For most clauses, queries don't currently call into the parent explicitly to get default components. I want to move more query construction logic up the class tree so it can be shared.

For most methods, this isn't a problem, but many subclasses define a `buildWhereClause()`. Make all such definitions protected and consistent.

This causes no behavioral changes.

Test Plan: Ran `arc unit --everything`, which does a pretty through job of verifying this statically.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: yelirekim, hach-que, epriestley

Maniphest Tasks: T4100, T5595

Differential Revision: https://secure.phabricator.com/D12453

+162 -116
+1 -1
src/applications/almanac/query/AlmanacBindingQuery.php
··· 93 93 return $bindings; 94 94 } 95 95 96 - protected function buildWhereClause($conn_r) { 96 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 97 97 $where = array(); 98 98 99 99 if ($this->ids !== null) {
+1 -1
src/applications/almanac/query/AlmanacDeviceQuery.php
··· 49 49 return $table->loadAllFromArray($data); 50 50 } 51 51 52 - protected function buildWhereClause($conn_r) { 52 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 53 53 $where = array(); 54 54 55 55 if ($this->ids !== null) {
+1 -1
src/applications/almanac/query/AlmanacInterfaceQuery.php
··· 83 83 return $interfaces; 84 84 } 85 85 86 - protected function buildWhereClause($conn_r) { 86 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 87 87 $where = array(); 88 88 89 89 if ($this->ids !== null) {
+1 -1
src/applications/almanac/query/AlmanacNetworkQuery.php
··· 31 31 return $table->loadAllFromArray($data); 32 32 } 33 33 34 - protected function buildWhereClause($conn_r) { 34 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 35 35 $where = array(); 36 36 37 37 if ($this->ids !== null) {
+1 -1
src/applications/almanac/query/AlmanacPropertyQuery.php
··· 71 71 return $properties; 72 72 } 73 73 74 - protected function buildWhereClause($conn_r) { 74 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 75 75 $where = array(); 76 76 77 77 if ($this->ids !== null) {
+1 -1
src/applications/almanac/query/AlmanacServiceQuery.php
··· 88 88 return implode(' ', $joins); 89 89 } 90 90 91 - protected function buildWhereClause($conn_r) { 91 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 92 92 $where = array(); 93 93 94 94 if ($this->ids !== null) {
+1 -1
src/applications/calendar/query/PhabricatorCalendarEventQuery.php
··· 51 51 return $table->loadAllFromArray($data); 52 52 } 53 53 54 - protected function buildWhereClause($conn_r) { 54 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 55 55 $where = array(); 56 56 57 57 if ($this->ids) {
+1 -1
src/applications/chatlog/query/PhabricatorChatLogChannelQuery.php
··· 33 33 return $logs; 34 34 } 35 35 36 - private function buildWhereClause($conn_r) { 36 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 37 37 $where = array(); 38 38 39 39 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/chatlog/query/PhabricatorChatLogQuery.php
··· 55 55 return $events; 56 56 } 57 57 58 - private function buildWhereClause($conn_r) { 58 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 59 59 $where = array(); 60 60 61 61 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/conduit/query/PhabricatorConduitLogQuery.php
··· 25 25 return $table->loadAllFromArray($data);; 26 26 } 27 27 28 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 28 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 29 29 $where = array(); 30 30 31 31 if ($this->methods) {
+1 -1
src/applications/conduit/query/PhabricatorConduitTokenQuery.php
··· 49 49 return $table->loadAllFromArray($data);; 50 50 } 51 51 52 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 52 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 53 53 $where = array(); 54 54 55 55 if ($this->ids !== null) {
+1 -1
src/applications/config/query/PhabricatorConfigEntryQuery.php
··· 31 31 return $table->loadAllFromArray($data); 32 32 } 33 33 34 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 34 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 35 35 $where = array(); 36 36 37 37 if ($this->ids) {
+1 -1
src/applications/conpherence/query/ConpherenceFulltextQuery.php
··· 32 32 return $rows; 33 33 } 34 34 35 - private function buildWhereClause($conn_r) { 35 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 36 36 $where = array(); 37 37 38 38 if ($this->threadPHIDs !== null) {
+1 -1
src/applications/conpherence/query/ConpherenceParticipantCountQuery.php
··· 42 42 return ipull($rows, 'count', 'participantPHID'); 43 43 } 44 44 45 - private function buildWhereClause($conn_r) { 45 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 46 46 $where = array(); 47 47 48 48 if ($this->participantPHIDs) {
+1 -1
src/applications/conpherence/query/ConpherenceParticipantQuery.php
··· 79 79 return $participants; 80 80 } 81 81 82 - private function buildWhereClause($conn_r) { 82 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 83 83 $where = array(); 84 84 85 85 if ($this->participantPHIDs) {
+1 -1
src/applications/conpherence/query/ConpherenceThreadQuery.php
··· 163 163 return false; 164 164 } 165 165 166 - protected function buildWhereClause($conn_r) { 166 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 167 167 $where = array(); 168 168 169 169 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/countdown/query/PhabricatorCountdownQuery.php
··· 45 45 return $countdowns; 46 46 } 47 47 48 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 48 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 49 49 $where = array(); 50 50 51 51 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/daemon/query/PhabricatorDaemonLogQuery.php
··· 124 124 return $daemons; 125 125 } 126 126 127 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 127 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 128 128 $where = array(); 129 129 130 130 if ($this->ids !== null) {
+1 -1
src/applications/dashboard/query/PhabricatorDashboardPanelQuery.php
··· 43 43 return $table->loadAllFromArray($data); 44 44 } 45 45 46 - protected function buildWhereClause($conn_r) { 46 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 47 47 $where = array(); 48 48 49 49 if ($this->ids !== null) {
+1 -1
src/applications/dashboard/query/PhabricatorDashboardQuery.php
··· 73 73 return $dashboards; 74 74 } 75 75 76 - protected function buildWhereClause($conn_r) { 76 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 77 77 $where = array(); 78 78 79 79 if ($this->ids) {
+1 -1
src/applications/differential/query/DifferentialChangesetQuery.php
··· 124 124 return $changesets; 125 125 } 126 126 127 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 127 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 128 128 $where = array(); 129 129 130 130 if ($this->diffs !== null) {
+1 -1
src/applications/differential/query/DifferentialDiffQuery.php
··· 121 121 return $diffs; 122 122 } 123 123 124 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 124 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 125 125 $where = array(); 126 126 127 127 if ($this->ids) {
+1 -1
src/applications/differential/query/DifferentialHunkQuery.php
··· 90 90 return $hunks; 91 91 } 92 92 93 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 93 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 94 94 $where = array(); 95 95 96 96 if (!$this->changesets) {
+1 -1
src/applications/differential/query/DifferentialInlineCommentQuery.php
··· 76 76 return head($this->execute()); 77 77 } 78 78 79 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 79 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 80 80 $where = array(); 81 81 82 82 // Only find inline comments.
+1 -1
src/applications/differential/query/DifferentialRevisionQuery.php
··· 693 693 /** 694 694 * @task internal 695 695 */ 696 - private function buildWhereClause($conn_r) { 696 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 697 697 $where = array(); 698 698 699 699 if ($this->pathIDs) {
+1 -1
src/applications/diffusion/query/DiffusionCommitQuery.php
··· 279 279 return $commits; 280 280 } 281 281 282 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 282 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 283 283 $where = array(); 284 284 285 285 if ($this->repositoryPHIDs !== null) {
+5 -2
src/applications/diffusion/query/DiffusionLintCountQuery.php
··· 56 56 'SELECT %s path_prefix, COUNT(*) N FROM %T %Q', 57 57 $key, 58 58 PhabricatorRepository::TABLE_LINTMESSAGE, 59 - $this->buildWhereClause($conn_r, $part)); 59 + $this->buildCustomWhereClause($conn_r, $part)); 60 60 } 61 61 62 62 $huge_union_query = '('.implode(') UNION ALL (', $queries).')'; ··· 69 69 return $this->processResults($data); 70 70 } 71 71 72 - private function buildWhereClause(AphrontDatabaseConnection $conn_r, $part) { 72 + protected function buildCustomWhereClause( 73 + AphrontDatabaseConnection $conn_r, 74 + $part) { 75 + 73 76 $where = array(); 74 77 75 78 $where[] = $part;
+1 -1
src/applications/diffusion/query/DiffusionPathQuery.php
··· 23 23 return ipull($results, null, 'id'); 24 24 } 25 25 26 - private function buildWhereClause($conn_r) { 26 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 27 27 $where = array(); 28 28 29 29 if ($this->pathIDs) {
+1 -1
src/applications/diffusion/query/DiffusionSymbolQuery.php
··· 184 184 /** 185 185 * @task internal 186 186 */ 187 - private function buildWhereClause($conn_r) { 187 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 188 188 $where = array(); 189 189 190 190 if (isset($this->context)) {
+1 -1
src/applications/diviner/query/DivinerAtomQuery.php
··· 259 259 return $atoms; 260 260 } 261 261 262 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 262 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 263 263 $where = array(); 264 264 265 265 if ($this->ids) {
+1 -1
src/applications/diviner/query/DivinerBookQuery.php
··· 36 36 return $table->loadAllFromArray($data); 37 37 } 38 38 39 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 39 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 40 40 $where = array(); 41 41 42 42 if ($this->ids) {
+1 -1
src/applications/doorkeeper/query/DoorkeeperExternalObjectQuery.php
··· 31 31 return $table->loadAllFromArray($data); 32 32 } 33 33 34 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 34 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 35 35 $where = array(); 36 36 37 37 if ($this->phids) {
+1 -1
src/applications/drydock/query/DrydockBlueprintQuery.php
··· 42 42 return $blueprints; 43 43 } 44 44 45 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 45 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 46 46 $where = array(); 47 47 48 48 if ($this->ids) {
+1 -1
src/applications/drydock/query/DrydockLeaseQuery.php
··· 69 69 return $leases; 70 70 } 71 71 72 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 72 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 73 73 $where = array(); 74 74 75 75 if ($this->resourceIDs) {
+1 -1
src/applications/drydock/query/DrydockLogQuery.php
··· 88 88 return $logs; 89 89 } 90 90 91 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 91 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 92 92 $where = array(); 93 93 94 94 if ($this->resourceIDs) {
+1 -1
src/applications/drydock/query/DrydockResourceQuery.php
··· 50 50 return $resources; 51 51 } 52 52 53 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 53 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 54 54 $where = array(); 55 55 56 56 if ($this->ids) {
+1 -1
src/applications/feed/query/PhabricatorFeedQuery.php
··· 49 49 $ref_table->getTableName()); 50 50 } 51 51 52 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 52 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 53 53 $where = array(); 54 54 55 55 if ($this->filterPHIDs) {
+1 -1
src/applications/files/query/PhabricatorFileChunkQuery.php
··· 86 86 return $chunks; 87 87 } 88 88 89 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 89 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 90 90 $where = array(); 91 91 92 92 if ($this->chunkHandles !== null) {
+1 -1
src/applications/files/query/PhabricatorFileQuery.php
··· 228 228 return implode(' ', $joins); 229 229 } 230 230 231 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 231 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 232 232 $where = array(); 233 233 234 234 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/flag/query/PhabricatorFlagQuery.php
··· 122 122 return $flags; 123 123 } 124 124 125 - private function buildWhereClause($conn_r) { 125 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 126 126 $where = array(); 127 127 128 128 if ($this->ownerPHIDs) {
+1 -1
src/applications/fund/query/FundBackerQuery.php
··· 68 68 return $backers; 69 69 } 70 70 71 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 71 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 72 72 $where = array(); 73 73 74 74 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/fund/query/FundInitiativeQuery.php
··· 73 73 return $initiatives; 74 74 } 75 75 76 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 76 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 77 77 $where = array(); 78 78 79 79 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/harbormaster/query/HarbormasterBuildArtifactQuery.php
··· 75 75 return $page; 76 76 } 77 77 78 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 78 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 79 79 $where = array(); 80 80 81 81 if ($this->ids) {
+1 -1
src/applications/harbormaster/query/HarbormasterBuildItemQuery.php
··· 31 31 return $table->loadAllFromArray($data); 32 32 } 33 33 34 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 34 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 35 35 $where = array(); 36 36 37 37 if ($this->ids) {
+1 -1
src/applications/harbormaster/query/HarbormasterBuildLogQuery.php
··· 62 62 return $page; 63 63 } 64 64 65 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 65 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 66 66 $where = array(); 67 67 68 68 if ($this->ids) {
+1 -1
src/applications/harbormaster/query/HarbormasterBuildMessageQuery.php
··· 62 62 return $page; 63 63 } 64 64 65 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 65 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 66 66 $where = array(); 67 67 68 68 if ($this->ids) {
+1 -1
src/applications/harbormaster/query/HarbormasterBuildPlanQuery.php
··· 43 43 return $table->loadAllFromArray($data); 44 44 } 45 45 46 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 46 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 47 47 $where = array(); 48 48 49 49 if ($this->ids) {
+1 -1
src/applications/harbormaster/query/HarbormasterBuildQuery.php
··· 136 136 return $page; 137 137 } 138 138 139 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 139 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 140 140 $where = array(); 141 141 142 142 if ($this->ids !== null) {
+1 -1
src/applications/harbormaster/query/HarbormasterBuildStepQuery.php
··· 37 37 return $table->loadAllFromArray($data); 38 38 } 39 39 40 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 40 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 41 41 $where = array(); 42 42 43 43 if ($this->ids) {
+1 -1
src/applications/harbormaster/query/HarbormasterBuildTargetQuery.php
··· 49 49 return $table->loadAllFromArray($data); 50 50 } 51 51 52 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 52 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 53 53 $where = array(); 54 54 55 55 if ($this->ids) {
+1 -1
src/applications/harbormaster/query/HarbormasterBuildableQuery.php
··· 172 172 return $page; 173 173 } 174 174 175 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 175 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 176 176 $where = array(); 177 177 178 178 if ($this->ids !== null) {
+1 -1
src/applications/herald/query/HeraldRuleQuery.php
··· 174 174 return $rules; 175 175 } 176 176 177 - private function buildWhereClause($conn_r) { 177 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 178 178 $where = array(); 179 179 180 180 if ($this->ids) {
+1 -1
src/applications/herald/query/HeraldTranscriptQuery.php
··· 85 85 return $transcripts; 86 86 } 87 87 88 - public function buildWhereClause(AphrontDatabaseConnection $conn_r) { 88 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 89 89 $where = array(); 90 90 91 91 if ($this->ids) {
+1 -1
src/applications/legalpad/query/LegalpadDocumentQuery.php
··· 165 165 } 166 166 } 167 167 168 - protected function buildWhereClause($conn_r) { 168 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 169 169 $where = array(); 170 170 171 171 if ($this->ids !== null) {
+1 -1
src/applications/legalpad/query/LegalpadDocumentSignatureQuery.php
··· 86 86 return $signatures; 87 87 } 88 88 89 - protected function buildWhereClause($conn_r) { 89 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 90 90 $where = array(); 91 91 92 92 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/mailinglists/query/PhabricatorMailingListQuery.php
··· 43 43 return $table->loadAllFromArray($data); 44 44 } 45 45 46 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 46 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 47 47 $where = array(); 48 48 49 49 if ($this->ids) {
+1 -1
src/applications/metamta/query/PhabricatorMetaMTAApplicationEmailQuery.php
··· 71 71 return $app_emails; 72 72 } 73 73 74 - private function buildWhereClause($conn_r) { 74 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 75 75 $where = array(); 76 76 77 77 if ($this->addresses !== null) {
+1 -1
src/applications/notification/query/PhabricatorNotificationQuery.php
··· 76 76 return $stories; 77 77 } 78 78 79 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 79 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 80 80 $where = array(); 81 81 82 82 if ($this->userPHIDs !== null) {
+1 -1
src/applications/nuance/query/NuanceItemQuery.php
··· 38 38 return $table->loadAllFromArray($data); 39 39 } 40 40 41 - protected function buildWhereClause($conn_r) { 41 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 42 42 $where = array(); 43 43 44 44 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/nuance/query/NuanceQueueQuery.php
··· 31 31 return $table->loadAllFromArray($data); 32 32 } 33 33 34 - protected function buildWhereClause($conn_r) { 34 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 35 35 $where = array(); 36 36 37 37 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/nuance/query/NuanceRequestorQuery.php
··· 31 31 return $table->loadAllFromArray($data); 32 32 } 33 33 34 - protected function buildWhereClause($conn_r) { 34 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 35 35 $where = array(); 36 36 37 37 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/nuance/query/NuanceSourceQuery.php
··· 44 44 return $table->loadAllFromArray($data); 45 45 } 46 46 47 - protected function buildWhereClause($conn_r) { 47 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 48 48 $where = array(); 49 49 50 50 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/oauthserver/query/PhabricatorOAuthClientAuthorizationQuery.php
··· 59 59 return $authorizations; 60 60 } 61 61 62 - private function buildWhereClause($conn_r) { 62 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 63 63 $where = array(); 64 64 65 65 if ($this->phids) {
+1 -1
src/applications/oauthserver/query/PhabricatorOAuthServerClientQuery.php
··· 37 37 return $table->loadAllFromArray($data); 38 38 } 39 39 40 - private function buildWhereClause($conn_r) { 40 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 41 41 $where = array(); 42 42 43 43 if ($this->ids) {
+1 -1
src/applications/owners/query/PhabricatorOwnersPackageQuery.php
··· 48 48 return implode(' ', $joins); 49 49 } 50 50 51 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 51 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 52 52 $where = array(); 53 53 54 54 if ($this->phids) {
+1 -1
src/applications/passphrase/query/PassphraseCredentialQuery.php
··· 99 99 return $page; 100 100 } 101 101 102 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 102 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 103 103 $where = array(); 104 104 105 105 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/paste/query/PhabricatorPasteQuery.php
··· 96 96 return $pastes; 97 97 } 98 98 99 - protected function buildWhereClause($conn_r) { 99 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 100 100 $where = array(); 101 101 102 102 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/people/query/PhabricatorPeopleLogQuery.php
··· 55 55 return $table->loadAllFromArray($data); 56 56 } 57 57 58 - private function buildWhereClause($conn_r) { 58 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 59 59 $where = array(); 60 60 61 61 if ($this->actorPHIDs !== null) {
+1 -1
src/applications/people/query/PhabricatorPeopleQuery.php
··· 227 227 return $joins; 228 228 } 229 229 230 - private function buildWhereClause($conn_r) { 230 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 231 231 $where = array(); 232 232 233 233 if ($this->usernames !== null) {
+1 -1
src/applications/phame/query/PhameBlogQuery.php
··· 43 43 return $blogs; 44 44 } 45 45 46 - private function buildWhereClause($conn_r) { 46 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 47 47 $where = array(); 48 48 49 49 if ($this->ids) {
+1 -1
src/applications/phame/query/PhamePostQuery.php
··· 81 81 return $posts; 82 82 } 83 83 84 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 84 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 85 85 $where = array(); 86 86 87 87 if ($this->ids) {
+1 -1
src/applications/phlux/query/PhluxVariableQuery.php
··· 37 37 return $table->loadAllFromArray($rows); 38 38 } 39 39 40 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 40 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 41 41 $where = array(); 42 42 43 43 if ($this->ids !== null) {
+1 -1
src/applications/pholio/query/PholioImageQuery.php
··· 61 61 return $images; 62 62 } 63 63 64 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 64 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 65 65 $where = array(); 66 66 67 67 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/pholio/query/PholioMockQuery.php
··· 82 82 return $mocks; 83 83 } 84 84 85 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 85 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 86 86 $where = array(); 87 87 88 88 $where[] = $this->buildPagingClause($conn_r);
+1 -1
src/applications/phortune/query/PhortuneAccountQuery.php
··· 73 73 return $accounts; 74 74 } 75 75 76 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 76 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 77 77 $where = array(); 78 78 79 79 $where[] = $this->buildPagingClause($conn);
+1 -1
src/applications/phortune/query/PhortuneCartQuery.php
··· 152 152 return $carts; 153 153 } 154 154 155 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 155 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 156 156 $where = array(); 157 157 158 158 $where[] = $this->buildPagingClause($conn);
+1 -1
src/applications/phortune/query/PhortuneChargeQuery.php
··· 94 94 return $charges; 95 95 } 96 96 97 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 97 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 98 98 $where = array(); 99 99 100 100 $where[] = $this->buildPagingClause($conn);
+1 -1
src/applications/phortune/query/PhortuneMerchantQuery.php
··· 53 53 return $merchants; 54 54 } 55 55 56 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 56 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 57 57 $where = array(); 58 58 59 59 if ($this->ids !== null) {
+1 -1
src/applications/phortune/query/PhortunePaymentMethodQuery.php
··· 106 106 return $methods; 107 107 } 108 108 109 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 109 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 110 110 $where = array(); 111 111 112 112 if ($this->ids !== null) {
+1 -1
src/applications/phortune/query/PhortunePaymentProviderConfigQuery.php
··· 59 59 return $provider_configs; 60 60 } 61 61 62 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 62 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 63 63 $where = array(); 64 64 65 65 if ($this->ids !== null) {
+1 -1
src/applications/phortune/query/PhortuneProductQuery.php
··· 77 77 return $page; 78 78 } 79 79 80 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 80 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 81 81 $where = array(); 82 82 83 83 if ($this->ids !== null) {
+1 -1
src/applications/phortune/query/PhortunePurchaseQuery.php
··· 74 74 return $purchases; 75 75 } 76 76 77 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 77 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 78 78 $where = array(); 79 79 80 80 $where[] = $this->buildPagingClause($conn);
+1 -1
src/applications/phortune/query/PhortuneSubscriptionQuery.php
··· 142 142 return $subscriptions; 143 143 } 144 144 145 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 145 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 146 146 $where = array(); 147 147 148 148 $where[] = $this->buildPagingClause($conn);
+1 -1
src/applications/phragment/query/PhragmentFragmentQuery.php
··· 55 55 return $table->loadAllFromArray($data); 56 56 } 57 57 58 - protected function buildWhereClause($conn_r) { 58 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 59 59 $where = array(); 60 60 61 61 if ($this->ids) {
+1 -1
src/applications/phragment/query/PhragmentFragmentVersionQuery.php
··· 49 49 return $table->loadAllFromArray($data); 50 50 } 51 51 52 - protected function buildWhereClause($conn_r) { 52 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 53 53 $where = array(); 54 54 55 55 if ($this->ids) {
+1 -1
src/applications/phragment/query/PhragmentSnapshotChildQuery.php
··· 55 55 return $table->loadAllFromArray($data); 56 56 } 57 57 58 - protected function buildWhereClause($conn_r) { 58 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 59 59 $where = array(); 60 60 61 61 if ($this->ids) {
+1 -1
src/applications/phragment/query/PhragmentSnapshotQuery.php
··· 43 43 return $table->loadAllFromArray($data); 44 44 } 45 45 46 - protected function buildWhereClause($conn_r) { 46 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 47 47 $where = array(); 48 48 49 49 if ($this->ids) {
+1 -1
src/applications/phrequent/query/PhrequentUserTimeQuery.php
··· 73 73 return $this; 74 74 } 75 75 76 - private function buildWhereClause(AphrontDatabaseConnection $conn) { 76 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 77 77 $where = array(); 78 78 79 79 if ($this->ids !== null) {
+1 -1
src/applications/ponder/query/PonderAnswerQuery.php
··· 36 36 return $this; 37 37 } 38 38 39 - private function buildWhereClause($conn_r) { 39 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 40 40 $where = array(); 41 41 42 42 if ($this->ids) {
+1 -1
src/applications/ponder/query/PonderQuestionQuery.php
··· 51 51 return $this; 52 52 } 53 53 54 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 54 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 55 55 $where = array(); 56 56 57 57 if ($this->ids) {
+1 -1
src/applications/project/query/PhabricatorProjectColumnPositionQuery.php
··· 262 262 return $page; 263 263 } 264 264 265 - private function buildWhereClause($conn_r) { 265 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 266 266 $where = array(); 267 267 268 268 if ($this->ids !== null) {
+1 -1
src/applications/project/query/PhabricatorProjectColumnQuery.php
··· 69 69 return $page; 70 70 } 71 71 72 - private function buildWhereClause($conn_r) { 72 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 73 73 $where = array(); 74 74 75 75 if ($this->ids) {
+1 -1
src/applications/project/query/PhabricatorProjectQuery.php
··· 240 240 return $projects; 241 241 } 242 242 243 - private function buildWhereClause($conn_r) { 243 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 244 244 $where = array(); 245 245 246 246 if ($this->status != self::STATUS_ANY) {
+1 -1
src/applications/releeph/query/ReleephBranchQuery.php
··· 103 103 return $branches; 104 104 } 105 105 106 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 106 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 107 107 $where = array(); 108 108 109 109 if ($this->ids !== null) {
+1 -1
src/applications/releeph/query/ReleephProductQuery.php
··· 111 111 return $products; 112 112 } 113 113 114 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 114 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 115 115 $where = array(); 116 116 117 117 if ($this->active !== null) {
+1 -1
src/applications/releeph/query/ReleephRequestQuery.php
··· 147 147 return $requests; 148 148 } 149 149 150 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 150 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 151 151 $where = array(); 152 152 153 153 if ($this->ids !== null) {
+1 -1
src/applications/repository/query/PhabricatorRepositoryArcanistProjectQuery.php
··· 56 56 return $projects; 57 57 } 58 58 59 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 59 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 60 60 $where = array(); 61 61 62 62 if ($this->ids) {
+1 -1
src/applications/repository/query/PhabricatorRepositoryMirrorQuery.php
··· 63 63 return $mirrors; 64 64 } 65 65 66 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 66 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 67 67 $where = array(); 68 68 69 69 if ($this->ids) {
+1 -1
src/applications/repository/query/PhabricatorRepositoryPushEventQuery.php
··· 88 88 return $events; 89 89 } 90 90 91 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 91 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 92 92 $where = array(); 93 93 94 94 if ($this->ids) {
+1 -1
src/applications/repository/query/PhabricatorRepositoryPushLogQuery.php
··· 82 82 return $logs; 83 83 } 84 84 85 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 85 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 86 86 $where = array(); 87 87 88 88 if ($this->ids) {
+1 -1
src/applications/repository/query/PhabricatorRepositoryQuery.php
··· 418 418 return implode(' ', $joins); 419 419 } 420 420 421 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 421 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 422 422 $where = array(); 423 423 424 424 if ($this->ids) {
+1 -1
src/applications/repository/query/PhabricatorRepositoryRefCursorQuery.php
··· 59 59 return $refs; 60 60 } 61 61 62 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 62 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 63 63 $where = array(); 64 64 65 65 if ($this->repositoryPHIDs !== null) {
+1 -1
src/applications/search/query/PhabricatorNamedQueryQuery.php
··· 43 43 return $table->loadAllFromArray($data); 44 44 } 45 45 46 - private function buildWhereClause($conn_r) { 46 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 47 47 $where = array(); 48 48 49 49 if ($this->ids) {
+1 -1
src/applications/search/query/PhabricatorSavedQueryQuery.php
··· 37 37 return $table->loadAllFromArray($data); 38 38 } 39 39 40 - private function buildWhereClause($conn_r) { 40 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 41 41 $where = array(); 42 42 43 43 if ($this->ids !== null) {
+1 -1
src/applications/slowvote/query/PhabricatorSlowvoteQuery.php
··· 125 125 return $polls; 126 126 } 127 127 128 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 128 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 129 129 $where = array(); 130 130 131 131 if ($this->ids) {
+1 -1
src/applications/tokens/query/PhabricatorTokenCountQuery.php
··· 24 24 return ipull($rows, 'tokenCount', 'objectPHID'); 25 25 } 26 26 27 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 27 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 28 28 $where = array(); 29 29 30 30 if ($this->objectPHIDs) {
+1 -1
src/applications/tokens/query/PhabricatorTokenGivenQuery.php
··· 37 37 return $table->loadAllFromArray($rows); 38 38 } 39 39 40 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 40 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 41 41 $where = array(); 42 42 43 43 if ($this->authorPHIDs) {
+1 -1
src/applications/transactions/query/PhabricatorApplicationTransactionCommentQuery.php
··· 57 57 return $table->loadAllFromArray($data); 58 58 } 59 59 60 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 60 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 61 61 return $this->formatWhereClause($this->buildWhereClauseComponents($conn_r)); 62 62 } 63 63
+1 -1
src/applications/transactions/query/PhabricatorApplicationTransactionQuery.php
··· 142 142 return $xactions; 143 143 } 144 144 145 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 145 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 146 146 $where = array(); 147 147 148 148 if ($this->phids) {
+1 -1
src/infrastructure/daemon/workers/query/PhabricatorWorkerArchiveTaskQuery.php
··· 49 49 return $task_table->loadAllFromArray($rows); 50 50 } 51 51 52 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 52 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 53 53 $where = array(); 54 54 55 55 if ($this->ids !== null) {
+5 -2
src/infrastructure/daemon/workers/query/PhabricatorWorkerLeaseQuery.php
··· 122 122 $conn_w, 123 123 'SELECT id, leaseOwner FROM %T %Q %Q %Q', 124 124 $task_table->getTableName(), 125 - $this->buildWhereClause($conn_w, $phase), 125 + $this->buildCustomWhereClause($conn_w, $phase), 126 126 $this->buildOrderClause($conn_w, $phase), 127 127 $this->buildLimitClause($conn_w, $limit - $leased)); 128 128 ··· 206 206 return $tasks; 207 207 } 208 208 209 - private function buildWhereClause(AphrontDatabaseConnection $conn_w, $phase) { 209 + protected function buildCustomWhereClause( 210 + AphrontDatabaseConnection $conn_w, 211 + $phase) { 212 + 210 213 $where = array(); 211 214 212 215 switch ($phase) {
+1 -1
src/infrastructure/daemon/workers/query/PhabricatorWorkerTriggerQuery.php
··· 160 160 return implode(' ', $joins); 161 161 } 162 162 163 - private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 163 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 164 164 $where = array(); 165 165 166 166 if ($this->ids !== null) {
+1 -1
src/infrastructure/edges/query/PhabricatorEdgeQuery.php
··· 289 289 /** 290 290 * @task internal 291 291 */ 292 - private function buildWhereClause($conn_r) { 292 + protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { 293 293 $where = array(); 294 294 295 295 if ($this->sourcePHIDs) {
+41 -1
src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
··· 4 4 * A query class which uses cursor-based paging. This paging is much more 5 5 * performant than offset-based paging in the presence of policy filtering. 6 6 * 7 + * @task clauses Building Query Clauses 7 8 * @task appsearch Integration with ApplicationSearch 9 + * @task customfield Integration with CustomField 8 10 * @task paging Paging 9 11 * @task order Result Ordering 10 12 */ ··· 175 177 } 176 178 177 179 180 + /* -( Building Query Clauses )--------------------------------------------- */ 181 + 182 + 183 + /** 184 + * @task clauses 185 + */ 186 + protected function buildWhereClause(AphrontDatabaseConnection $conn) { 187 + throw new PhutilMethodNotImplementedException(); 188 + } 189 + 190 + 178 191 /* -( Paging )------------------------------------------------------------- */ 179 192 180 193 194 + /** 195 + * @task paging 196 + */ 181 197 protected function buildPagingClause(AphrontDatabaseConnection $conn) { 182 198 $orderable = $this->getOrderableColumns(); 183 199 $vector = $this->getOrderVector(); ··· 228 244 )); 229 245 } 230 246 247 + 248 + /** 249 + * @task paging 250 + */ 231 251 protected function getPagingValueMap($cursor, array $keys) { 232 - // TODO: This is a hack to make this work with existing classes for now. 233 252 return array( 234 253 'id' => $cursor, 235 254 ); 236 255 } 237 256 257 + 258 + /** 259 + * @task paging 260 + */ 238 261 protected function loadCursorObject($cursor) { 239 262 $query = newv(get_class($this), array()) 240 263 ->setViewer($this->getPagingViewer()) ··· 253 276 return $object; 254 277 } 255 278 279 + 280 + /** 281 + * @task paging 282 + */ 256 283 protected function willExecuteCursorQuery( 257 284 PhabricatorCursorPagedPolicyAwareQuery $query) { 258 285 return; ··· 295 322 * @param list<map> Column description dictionaries. 296 323 * @param map Additional constuction options. 297 324 * @return string Query clause. 325 + * @task paging 298 326 */ 299 327 final protected function buildPagingClauseFromMultipleColumns( 300 328 AphrontDatabaseConnection $conn, ··· 1082 1110 return implode(' ', $joins); 1083 1111 } 1084 1112 1113 + 1114 + /* -( Integration with CustomField )--------------------------------------- */ 1115 + 1116 + 1117 + /** 1118 + * @task customfield 1119 + */ 1085 1120 protected function getPagingValueMapForCustomFields( 1086 1121 PhabricatorCustomFieldInterface $object) { 1087 1122 ··· 1100 1135 return $map; 1101 1136 } 1102 1137 1138 + 1139 + /** 1140 + * @task customfield 1141 + */ 1103 1142 protected function isCustomFieldOrderKey($key) { 1104 1143 $prefix = 'custom:'; 1105 1144 return !strncmp($key, $prefix, strlen($prefix)); 1106 1145 } 1146 + 1107 1147 1108 1148 }