Differential D12017 Diff 28942 src/applications/differential/query/DifferentialInlineCommentQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/query/DifferentialInlineCommentQuery.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Temporary wrapper for transitioning Differential to ApplicationTransactions. | * Temporary wrapper for transitioning Differential to ApplicationTransactions. | ||||
| */ | */ | ||||
| final class DifferentialInlineCommentQuery | final class DifferentialInlineCommentQuery | ||||
| extends PhabricatorOffsetPagedQuery { | extends PhabricatorOffsetPagedQuery { | ||||
| private $revisionIDs; | private $revisionIDs; | ||||
| private $notDraft; | private $notDraft; | ||||
| private $ids; | private $ids; | ||||
| private $phids; | |||||
| private $commentIDs; | private $commentIDs; | ||||
| private $viewerAndChangesetIDs; | private $viewerAndChangesetIDs; | ||||
| private $draftComments; | private $draftComments; | ||||
| private $draftsByAuthors; | private $draftsByAuthors; | ||||
| public function withRevisionIDs(array $ids) { | public function withRevisionIDs(array $ids) { | ||||
| $this->revisionIDs = $ids; | $this->revisionIDs = $ids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withNotDraft($not_draft) { | public function withNotDraft($not_draft) { | ||||
| $this->notDraft = $not_draft; | $this->notDraft = $not_draft; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withIDs(array $ids) { | public function withIDs(array $ids) { | ||||
| $this->ids = $ids; | $this->ids = $ids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withPHIDs(array $phids) { | |||||
| $this->phids = $phids; | |||||
| return $this; | |||||
| } | |||||
| public function withViewerAndChangesetIDs($author_phid, array $ids) { | public function withViewerAndChangesetIDs($author_phid, array $ids) { | ||||
| $this->viewerAndChangesetIDs = array($author_phid, $ids); | $this->viewerAndChangesetIDs = array($author_phid, $ids); | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withDraftComments($author_phid, $revision_id) { | public function withDraftComments($author_phid, $revision_id) { | ||||
| $this->draftComments = array($author_phid, $revision_id); | $this->draftComments = array($author_phid, $revision_id); | ||||
| return $this; | return $this; | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | private function buildWhereClause(AphrontDatabaseConnection $conn_r) { | ||||
| if ($this->ids) { | if ($this->ids) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn_r, | ||||
| 'id IN (%Ld)', | 'id IN (%Ld)', | ||||
| $this->ids); | $this->ids); | ||||
| } | } | ||||
| if ($this->phids !== null) { | |||||
| $where[] = qsprintf( | |||||
| $conn_r, | |||||
| 'phid IN (%Ls)', | |||||
| $this->phids); | |||||
| } | |||||
| if ($this->viewerAndChangesetIDs) { | if ($this->viewerAndChangesetIDs) { | ||||
| list($phid, $ids) = $this->viewerAndChangesetIDs; | list($phid, $ids) = $this->viewerAndChangesetIDs; | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn_r, | ||||
| 'changesetID IN (%Ld) AND | 'changesetID IN (%Ld) AND | ||||
| (authorPHID = %s OR transactionPHID IS NOT NULL)', | (authorPHID = %s OR transactionPHID IS NOT NULL)', | ||||
| $ids, | $ids, | ||||
| $phid); | $phid); | ||||
| Show All 35 Lines | |||||