private function loadRevisions($phid)
 {
     $table = new DifferentialRevision();
     $conn_r = $table->establishConnection('r');
     $rows = queryfx_all($conn_r, 'SELECT revisions.* FROM %T revisions ' . 'JOIN %T comments ON comments.revisionID = revisions.id ' . 'JOIN (' . ' SELECT revisionID FROM %T WHERE objectPHID = %s ' . ' UNION ALL ' . ' SELECT id from differential_revision WHERE authorPHID = %s) rel ' . 'ON (comments.revisionID = rel.revisionID)' . 'WHERE comments.action = %s' . 'AND comments.authorPHID = %s', $table->getTableName(), id(new DifferentialComment())->getTableName(), DifferentialRevision::RELATIONSHIP_TABLE, $phid, $phid, $this->filter, $phid);
     return $table->loadAllFromArray($rows);
 }
 /**
  * Execute the query as configured, returning matching
  * @{class:DifferentialRevision} objects.
  *
  * @return list List of matching DifferentialRevision objects.
  * @task exec
  */
 public function execute()
 {
     $table = new DifferentialRevision();
     $conn_r = $table->establishConnection('r');
     if ($this->shouldUseResponsibleFastPath()) {
         $data = $this->loadDataUsingResponsibleFastPath();
     } else {
         $data = $this->loadData();
     }
     $revisions = $table->loadAllFromArray($data);
     if ($revisions) {
         if ($this->needRelationships) {
             $this->loadRelationships($conn_r, $revisions);
         }
         if ($this->needCommitPHIDs) {
             $this->loadCommitPHIDs($conn_r, $revisions);
         }
         $need_active = $this->needActiveDiffs;
         $need_ids = $need_active || $this->needDiffIDs;
         if ($need_ids) {
             $this->loadDiffIDs($conn_r, $revisions);
         }
         if ($need_active) {
             $this->loadActiveDiffs($conn_r, $revisions);
         }
         if ($this->needHashes) {
             $this->loadHashes($conn_r, $revisions);
         }
     }
     return $revisions;
 }
 /**
  * Execute the query as configured, returning matching
  * @{class:DifferentialRevision} objects.
  *
  * @return list List of matching DifferentialRevision objects.
  * @task exec
  */
 public function loadPage()
 {
     $table = new DifferentialRevision();
     $conn_r = $table->establishConnection('r');
     $data = $this->loadData();
     return $table->loadAllFromArray($data);
 }
 private function loadAllOpenWithCCs(array $ccphids)
 {
     $rev = new DifferentialRevision();
     $revision = new DifferentialRevision();
     $data = queryfx_all($rev->establishConnection('r'), 'SELECT revision.* FROM %T revision
     JOIN %T relationship ON relationship.revisionID = revision.id
       AND relationship.relation = %s
       AND relationship.objectPHID in (%Ls)
     WHERE revision.status in (%Ld) %Q', $revision->getTableName(), DifferentialRevision::RELATIONSHIP_TABLE, DifferentialRevision::RELATION_SUBSCRIBED, $ccphids, $this->getOpenStatuses(), $this->getOrderClause());
     return $revision->loadAllFromArray($data);
 }