Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15364605
D12356.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D12356.diff
View Options
diff --git a/src/applications/files/query/PhabricatorFileQuery.php b/src/applications/files/query/PhabricatorFileQuery.php
--- a/src/applications/files/query/PhabricatorFileQuery.php
+++ b/src/applications/files/query/PhabricatorFileQuery.php
@@ -331,8 +331,8 @@
return $this->formatWhereClause($where);
}
- protected function getPagingColumn() {
- return 'f.id';
+ protected function getPrimaryTableAlias() {
+ return 'f';
}
public function getQueryApplicationClass() {
diff --git a/src/applications/macro/query/PhabricatorMacroQuery.php b/src/applications/macro/query/PhabricatorMacroQuery.php
--- a/src/applications/macro/query/PhabricatorMacroQuery.php
+++ b/src/applications/macro/query/PhabricatorMacroQuery.php
@@ -225,8 +225,8 @@
return $macros;
}
- protected function getPagingColumn() {
- return 'm.id';
+ protected function getPrimaryTableAlias() {
+ return 'm';
}
public function getQueryApplicationClass() {
diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php
--- a/src/applications/maniphest/query/ManiphestTaskQuery.php
+++ b/src/applications/maniphest/query/ManiphestTaskQuery.php
@@ -1137,8 +1137,8 @@
));
}
- protected function getApplicationSearchObjectPHIDColumn() {
- return 'task.phid';
+ protected function getPrimaryTableAlias() {
+ return 'task';
}
public function getQueryApplicationClass() {
diff --git a/src/applications/metamta/query/PhabricatorMetaMTAApplicationEmailQuery.php b/src/applications/metamta/query/PhabricatorMetaMTAApplicationEmailQuery.php
--- a/src/applications/metamta/query/PhabricatorMetaMTAApplicationEmailQuery.php
+++ b/src/applications/metamta/query/PhabricatorMetaMTAApplicationEmailQuery.php
@@ -114,12 +114,8 @@
return $this->formatWhereClause($where);
}
- protected function getPagingColumn() {
- return 'appemail.id';
- }
-
- protected function getApplicationSearchObjectPHIDColumn() {
- return 'appemail.phid';
+ protected function getPrimaryTableAlias() {
+ return 'appemail';
}
public function getQueryApplicationClass() {
diff --git a/src/applications/people/query/PhabricatorPeopleQuery.php b/src/applications/people/query/PhabricatorPeopleQuery.php
--- a/src/applications/people/query/PhabricatorPeopleQuery.php
+++ b/src/applications/people/query/PhabricatorPeopleQuery.php
@@ -288,12 +288,8 @@
return $this->formatWhereClause($where);
}
- protected function getPagingColumn() {
- return 'user.id';
- }
-
- protected function getApplicationSearchObjectPHIDColumn() {
- return 'user.phid';
+ protected function getPrimaryTableAlias() {
+ return 'user';
}
public function getQueryApplicationClass() {
diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php
--- a/src/applications/project/query/PhabricatorProjectQuery.php
+++ b/src/applications/project/query/PhabricatorProjectQuery.php
@@ -380,8 +380,8 @@
return 'PhabricatorProjectApplication';
}
- protected function getApplicationSearchObjectPHIDColumn() {
- return 'p.phid';
+ protected function getPrimaryTableAlias() {
+ return 'p';
}
}
diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteQuery.php b/src/applications/slowvote/query/PhabricatorSlowvoteQuery.php
--- a/src/applications/slowvote/query/PhabricatorSlowvoteQuery.php
+++ b/src/applications/slowvote/query/PhabricatorSlowvoteQuery.php
@@ -174,8 +174,8 @@
return implode(' ', $joins);
}
- protected function getPagingColumn() {
- return 'p.id';
+ protected function getPrimaryTableAlias() {
+ return 'p';
}
public function getQueryApplicationClass() {
diff --git a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
--- a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
+++ b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
@@ -147,6 +147,21 @@
}
+ /**
+ * Return the alias this query uses to identify the primary table.
+ *
+ * Some automatic query constructions may need to be qualified with a table
+ * alias if the query performs joins which make column names ambiguous. If
+ * this is the case, return the alias for the primary table the query
+ * uses; generally the object table which has `id` and `phid` columns.
+ *
+ * @return string Alias for the primary table.
+ */
+ protected function getPrimaryTableAlias() {
+ return null;
+ }
+
+
/* -( Paging )------------------------------------------------------------- */
@@ -450,7 +465,7 @@
return array(
'id' => array(
- 'table' => null,
+ 'table' => $this->getPrimaryTableAlias(),
'column' => 'id',
'reverse' => false,
'type' => 'int',
@@ -657,15 +672,23 @@
/**
* Get the name of the query's primary object PHID column, for constructing
- * JOIN clauses. Normally (and by default) this is just `"phid"`, but if the
- * query construction requires a table alias it may be something like
- * `"task.phid"`.
+ * JOIN clauses. Normally (and by default) this is just `"phid"`, but it may
+ * be something more exotic.
+ *
+ * See @{method:getPrimaryTableAlias} if the column needs to be qualified with
+ * a table alias.
*
* @return string Column name.
* @task appsearch
*/
protected function getApplicationSearchObjectPHIDColumn() {
- return 'phid';
+ if ($this->getPrimaryTableAlias()) {
+ $prefix = $this->getPrimaryTableAlias().'.';
+ } else {
+ $prefix = '';
+ }
+
+ return $prefix.'phid';
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 12, 1:43 PM (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7587628
Default Alt Text
D12356.diff (5 KB)
Attached To
Mode
D12356: Remove trivial implementations of getPagingColumn()
Attached
Detach File
Event Timeline
Log In to Comment