protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->ownerPHIDs !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T o ON o.packageID = p.id', id(new PhabricatorOwnersOwner())->getTableName());
     }
     if ($this->repositoryPHIDs !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T rpath ON rpath.packageID = p.id', id(new PhabricatorOwnersPath())->getTableName());
     }
     return $joins;
 }
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->memberPHIDs !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T e ON e.src = p.phid AND e.type = %d', PhabricatorEdgeConfig::TABLE_NAME_EDGE, PhabricatorProjectMaterializedMemberEdgeType::EDGECONST);
     }
     if ($this->watcherPHIDs !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T w ON w.src = p.phid AND w.type = %d', PhabricatorEdgeConfig::TABLE_NAME_EDGE, PhabricatorObjectHasWatcherEdgeType::EDGECONST);
     }
     if ($this->slugs !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T slug on slug.projectPHID = p.phid', id(new PhabricatorProjectSlug())->getTableName());
     }
     if ($this->nameTokens !== null) {
         foreach ($this->nameTokens as $key => $token) {
             $token_table = 'token_' . $key;
             $joins[] = qsprintf($conn, 'JOIN %T %T ON %T.projectID = p.id AND %T.token LIKE %>', PhabricatorProject::TABLE_DATASOURCE_TOKEN, $token_table, $token_table, $token_table, $token);
         }
     }
     return $joins;
 }
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn_r)
 {
     $parts = parent::buildJoinClauseParts($conn_r);
     if ($this->inviteePHIDs !== null) {
         $parts[] = qsprintf($conn_r, 'JOIN %T invitee ON invitee.eventPHID = event.phid
       AND invitee.status != %s', id(new PhabricatorCalendarEventInvitee())->getTableName(), PhabricatorCalendarEventInvitee::STATUS_UNINVITED);
     }
     return $parts;
 }
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->shouldJoinSummaryTable()) {
         $joins[] = qsprintf($conn, 'LEFT JOIN %T s ON r.id = s.repositoryID', PhabricatorRepository::TABLE_SUMMARY);
     }
     if ($this->shouldJoinURITable()) {
         $joins[] = qsprintf($conn, 'LEFT JOIN %T uri ON r.phid = uri.repositoryPHID', id(new PhabricatorRepositoryURIIndex())->getTableName());
     }
     return $joins;
 }
Exemplo n.º 5
0
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn_r)
 {
     $edge_table = PhabricatorEdgeConfig::TABLE_NAME_EDGE;
     $joins = array();
     if ($this->shouldJoinBlockingTasks()) {
         $joins[] = qsprintf($conn_r, 'LEFT JOIN %T blocking ON blocking.src = task.phid ' . 'AND blocking.type = %d ' . 'LEFT JOIN %T blockingtask ON blocking.dst = blockingtask.phid', $edge_table, ManiphestTaskDependedOnByTaskEdgeType::EDGECONST, id(new ManiphestTask())->getTableName());
     }
     if ($this->shouldJoinBlockedTasks()) {
         $joins[] = qsprintf($conn_r, 'LEFT JOIN %T blocked ON blocked.src = task.phid ' . 'AND blocked.type = %d ' . 'LEFT JOIN %T blockedtask ON blocked.dst = blockedtask.phid', $edge_table, ManiphestTaskDependsOnTaskEdgeType::EDGECONST, id(new ManiphestTask())->getTableName());
     }
     if ($this->subscriberPHIDs !== null) {
         $joins[] = qsprintf($conn_r, 'JOIN %T e_ccs ON e_ccs.src = task.phid ' . 'AND e_ccs.type = %s ' . 'AND e_ccs.dst in (%Ls)', PhabricatorEdgeConfig::TABLE_NAME_EDGE, PhabricatorObjectHasSubscriberEdgeType::EDGECONST, $this->subscriberPHIDs);
     }
     switch ($this->groupBy) {
         case self::GROUP_PROJECT:
             $ignore_group_phids = $this->getIgnoreGroupedProjectPHIDs();
             if ($ignore_group_phids) {
                 $joins[] = qsprintf($conn_r, 'LEFT JOIN %T projectGroup ON task.phid = projectGroup.src
           AND projectGroup.type = %d
           AND projectGroup.dst NOT IN (%Ls)', $edge_table, PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, $ignore_group_phids);
             } else {
                 $joins[] = qsprintf($conn_r, 'LEFT JOIN %T projectGroup ON task.phid = projectGroup.src
           AND projectGroup.type = %d', $edge_table, PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
             }
             $joins[] = qsprintf($conn_r, 'LEFT JOIN %T projectGroupName
         ON projectGroup.dst = projectGroupName.indexedObjectPHID', id(new ManiphestNameIndex())->getTableName());
             break;
     }
     $joins[] = parent::buildJoinClauseParts($conn_r);
     return $joins;
 }
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->shouldJoinSummaryTable()) {
         $joins[] = qsprintf($conn, 'LEFT JOIN %T s ON r.id = s.repositoryID', PhabricatorRepository::TABLE_SUMMARY);
     }
     return $joins;
 }
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->emails) {
         $email_table = new PhabricatorUserEmail();
         $joins[] = qsprintf($conn, 'JOIN %T email ON email.userPHID = user.PHID', $email_table->getTableName());
     }
     if ($this->nameTokens) {
         foreach ($this->nameTokens as $key => $token) {
             $token_table = 'token_' . $key;
             $joins[] = qsprintf($conn, 'JOIN %T %T ON %T.userID = user.id AND %T.token LIKE %>', PhabricatorUser::NAMETOKEN_TABLE, $token_table, $token_table, $token_table, $token);
         }
     }
     return $joins;
 }
Exemplo n.º 8
0
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $open_statuses = ManiphestTaskStatus::getOpenStatusConstants();
     $edge_table = PhabricatorEdgeConfig::TABLE_NAME_EDGE;
     $task_table = $this->newResultObject()->getTableName();
     $parent_type = ManiphestTaskDependedOnByTaskEdgeType::EDGECONST;
     $subtask_type = ManiphestTaskDependsOnTaskEdgeType::EDGECONST;
     $joins = array();
     if ($this->hasOpenParents !== null) {
         if ($this->hasOpenParents) {
             $join_type = 'JOIN';
         } else {
             $join_type = 'LEFT JOIN';
         }
         $joins[] = qsprintf($conn, '%Q %T e_parent
       ON e_parent.src = task.phid
       AND e_parent.type = %d
      %Q %T parent
        ON e_parent.dst = parent.phid
        AND parent.status IN (%Ls)', $join_type, $edge_table, $parent_type, $join_type, $task_table, $open_statuses);
     }
     if ($this->hasOpenSubtasks !== null) {
         if ($this->hasOpenSubtasks) {
             $join_type = 'JOIN';
         } else {
             $join_type = 'LEFT JOIN';
         }
         $joins[] = qsprintf($conn, '%Q %T e_subtask
       ON e_subtask.src = task.phid
       AND e_subtask.type = %d
      %Q %T subtask
        ON e_subtask.dst = subtask.phid
        AND subtask.status IN (%Ls)', $join_type, $edge_table, $subtask_type, $join_type, $task_table, $open_statuses);
     }
     if ($this->subscriberPHIDs !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T e_ccs ON e_ccs.src = task.phid ' . 'AND e_ccs.type = %s ' . 'AND e_ccs.dst in (%Ls)', PhabricatorEdgeConfig::TABLE_NAME_EDGE, PhabricatorObjectHasSubscriberEdgeType::EDGECONST, $this->subscriberPHIDs);
     }
     switch ($this->groupBy) {
         case self::GROUP_PROJECT:
             $ignore_group_phids = $this->getIgnoreGroupedProjectPHIDs();
             if ($ignore_group_phids) {
                 $joins[] = qsprintf($conn, 'LEFT JOIN %T projectGroup ON task.phid = projectGroup.src
           AND projectGroup.type = %d
           AND projectGroup.dst NOT IN (%Ls)', $edge_table, PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, $ignore_group_phids);
             } else {
                 $joins[] = qsprintf($conn, 'LEFT JOIN %T projectGroup ON task.phid = projectGroup.src
           AND projectGroup.type = %d', $edge_table, PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
             }
             $joins[] = qsprintf($conn, 'LEFT JOIN %T projectGroupName
         ON projectGroup.dst = projectGroupName.indexedObjectPHID', id(new ManiphestNameIndex())->getTableName());
             break;
     }
     if ($this->parentTaskIDs !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T e_has_parent
       ON e_has_parent.src = task.phid
       AND e_has_parent.type = %d
      JOIN %T has_parent
        ON e_has_parent.dst = has_parent.phid
        AND has_parent.id IN (%Ld)', $edge_table, $parent_type, $task_table, $this->parentTaskIDs);
     }
     if ($this->subtaskIDs !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T e_has_subtask
       ON e_has_subtask.src = task.phid
       AND e_has_subtask.type = %d
      JOIN %T has_subtask
        ON e_has_subtask.dst = has_subtask.phid
        AND has_subtask.id IN (%Ld)', $edge_table, $subtask_type, $task_table, $this->subtaskIDs);
     }
     $joins[] = parent::buildJoinClauseParts($conn);
     return $joins;
 }
Exemplo n.º 9
0
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->transforms) {
         $joins[] = qsprintf($conn, 'JOIN %T t ON t.transformedPHID = f.phid', id(new PhabricatorTransformedFile())->getTableName());
     }
     return $joins;
 }
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->participantPHIDs !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T p ON p.conpherencePHID = thread.phid', id(new ConpherenceParticipant())->getTableName());
     }
     if (strlen($this->fulltext)) {
         $joins[] = qsprintf($conn, 'JOIN %T idx ON idx.threadPHID = thread.phid', id(new ConpherenceIndex())->getTableName());
     }
     // See note in buildWhereClauseParts() about this optimization.
     $viewer = $this->getViewer();
     if (!$viewer->isOmnipotent() && $viewer->isLoggedIn()) {
         $joins[] = qsprintf($conn, 'LEFT JOIN %T vp ON vp.conpherencePHID = thread.phid
       AND vp.participantPHID = %s', id(new ConpherenceParticipant())->getTableName(), $viewer->getPHID());
     }
     return $joins;
 }
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $join = parent::buildJoinClauseParts($conn);
     $audit_request = new PhabricatorRepositoryAuditRequest();
     if ($this->shouldJoinStatus()) {
         $join[] = qsprintf($conn, 'LEFT JOIN %T status ON commit.phid = status.commitPHID', $audit_request->getTableName());
     }
     if ($this->shouldJoinAudits()) {
         $join[] = qsprintf($conn, 'JOIN %T audit ON commit.phid = audit.commitPHID', $audit_request->getTableName());
     }
     if ($this->shouldJoinNeeds()) {
         $join[] = qsprintf($conn, 'JOIN %T needs ON commit.phid = needs.commitPHID
       AND needs.auditStatus IN (%Ls)', $audit_request->getTableName(), array(PhabricatorAuditStatusConstants::AUDIT_REQUESTED, PhabricatorAuditStatusConstants::AUDIT_REQUIRED));
     }
     return $join;
 }
Exemplo n.º 12
0
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->withVotesByViewer !== null) {
         $joins[] = qsprintf($conn, 'JOIN %T vv ON vv.pollID = p.id AND vv.authorPHID = %s', id(new PhabricatorSlowvoteChoice())->getTableName(), $this->getViewer()->getPHID());
     }
     return $joins;
 }
Exemplo n.º 13
0
 protected function buildJoinClauseParts(AphrontDatabaseConnection $conn)
 {
     $joins = parent::buildJoinClauseParts($conn);
     if ($this->answererPHIDs) {
         $answer_table = new PonderAnswer();
         $joins[] = qsprintf($conn, 'JOIN %T a ON a.questionID = q.id AND a.authorPHID IN (%Ls)', $answer_table->getTableName(), $this->answererPHIDs);
     }
     return $joins;
 }