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 @@ -464,28 +464,28 @@ } $where[] = qsprintf( $conn, - 'status IN (%Ld)', + 'project.status IN (%Ld)', $filter); } if ($this->statuses !== null) { $where[] = qsprintf( $conn, - 'status IN (%Ls)', + 'project.status IN (%Ls)', $this->statuses); } if ($this->ids !== null) { $where[] = qsprintf( $conn, - 'id IN (%Ld)', + 'project.id IN (%Ld)', $this->ids); } if ($this->phids !== null) { $where[] = qsprintf( $conn, - 'phid IN (%Ls)', + 'project.phid IN (%Ls)', $this->phids); } @@ -513,7 +513,7 @@ if ($this->names !== null) { $where[] = qsprintf( $conn, - 'name IN (%Ls)', + 'project.name IN (%Ls)', $this->names); } @@ -522,7 +522,7 @@ foreach ($this->namePrefixes as $name_prefix) { $parts[] = qsprintf( $conn, - 'name LIKE %>', + 'project.name LIKE %>', $name_prefix); } $where[] = qsprintf($conn, '%LO', $parts); @@ -531,21 +531,21 @@ if ($this->icons !== null) { $where[] = qsprintf( $conn, - 'icon IN (%Ls)', + 'project.icon IN (%Ls)', $this->icons); } if ($this->colors !== null) { $where[] = qsprintf( $conn, - 'color IN (%Ls)', + 'project.color IN (%Ls)', $this->colors); } if ($this->parentPHIDs !== null) { $where[] = qsprintf( $conn, - 'parentProjectPHID IN (%Ls)', + 'project.parentProjectPHID IN (%Ls)', $this->parentPHIDs); } @@ -563,7 +563,7 @@ foreach ($ancestor_paths as $ancestor_path) { $sql[] = qsprintf( $conn, - '(projectPath LIKE %> AND projectDepth > %d)', + '(project.projectPath LIKE %> AND project.projectDepth > %d)', $ancestor_path['projectPath'], $ancestor_path['projectDepth']); } @@ -572,18 +572,18 @@ $where[] = qsprintf( $conn, - 'parentProjectPHID IS NOT NULL'); + 'project.parentProjectPHID IS NOT NULL'); } if ($this->isMilestone !== null) { if ($this->isMilestone) { $where[] = qsprintf( $conn, - 'milestoneNumber IS NOT NULL'); + 'project.milestoneNumber IS NOT NULL'); } else { $where[] = qsprintf( $conn, - 'milestoneNumber IS NULL'); + 'project.milestoneNumber IS NULL'); } } @@ -591,42 +591,42 @@ if ($this->hasSubprojects !== null) { $where[] = qsprintf( $conn, - 'hasSubprojects = %d', + 'project.hasSubprojects = %d', (int)$this->hasSubprojects); } if ($this->minDepth !== null) { $where[] = qsprintf( $conn, - 'projectDepth >= %d', + 'project.projectDepth >= %d', $this->minDepth); } if ($this->maxDepth !== null) { $where[] = qsprintf( $conn, - 'projectDepth <= %d', + 'project.projectDepth <= %d', $this->maxDepth); } if ($this->minMilestoneNumber !== null) { $where[] = qsprintf( $conn, - 'milestoneNumber >= %d', + 'project.milestoneNumber >= %d', $this->minMilestoneNumber); } if ($this->maxMilestoneNumber !== null) { $where[] = qsprintf( $conn, - 'milestoneNumber <= %d', + 'project.milestoneNumber <= %d', $this->maxMilestoneNumber); } if ($this->subtypes !== null) { $where[] = qsprintf( $conn, - 'subtype IN (%Ls)', + 'project.subtype IN (%Ls)', $this->subtypes); } @@ -646,7 +646,7 @@ if ($this->memberPHIDs !== null) { $joins[] = qsprintf( $conn, - 'JOIN %T e ON e.src = p.phid AND e.type = %d', + 'JOIN %T e ON e.src = project.phid AND e.type = %d', PhabricatorEdgeConfig::TABLE_NAME_EDGE, PhabricatorProjectMaterializedMemberEdgeType::EDGECONST); } @@ -654,7 +654,7 @@ if ($this->watcherPHIDs !== null) { $joins[] = qsprintf( $conn, - 'JOIN %T w ON w.src = p.phid AND w.type = %d', + 'JOIN %T w ON w.src = project.phid AND w.type = %d', PhabricatorEdgeConfig::TABLE_NAME_EDGE, PhabricatorObjectHasWatcherEdgeType::EDGECONST); } @@ -662,7 +662,7 @@ if ($this->slugs !== null) { $joins[] = qsprintf( $conn, - 'JOIN %T slug on slug.projectPHID = p.phid', + 'JOIN %T slug on slug.projectPHID = project.phid', id(new PhabricatorProjectSlug())->getTableName()); } @@ -672,7 +672,7 @@ $token_table = 'token_'.$key; $joins[] = qsprintf( $conn, - 'JOIN %T %T ON %T.projectID = p.id AND %T.token LIKE %>', + 'JOIN %T %T ON %T.projectID = project.id AND %T.token LIKE %>', PhabricatorProject::TABLE_DATASOURCE_TOKEN, $token_table, $token_table, @@ -689,7 +689,7 @@ } protected function getPrimaryTableAlias() { - return 'p'; + return 'project'; } private function linkProjectGraph(array $projects, array $ancestors) {