Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/query/PhabricatorSlowvoteQuery.php
<?php | <?php | ||||
final class PhabricatorSlowvoteQuery | final class PhabricatorSlowvoteQuery | ||||
extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
private $ids; | private $ids; | ||||
private $phids; | private $phids; | ||||
private $authorPHIDs; | private $authorPHIDs; | ||||
private $withVotesByViewer; | private $withVotesByViewer; | ||||
private $isClosed; | private $statuses; | ||||
private $needOptions; | private $needOptions; | ||||
private $needChoices; | private $needChoices; | ||||
private $needViewerChoices; | private $needViewerChoices; | ||||
public function withIDs($ids) { | public function withIDs($ids) { | ||||
$this->ids = $ids; | $this->ids = $ids; | ||||
return $this; | return $this; | ||||
Show All 9 Lines | public function withAuthorPHIDs($author_phids) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withVotesByViewer($with_vote) { | public function withVotesByViewer($with_vote) { | ||||
$this->withVotesByViewer = $with_vote; | $this->withVotesByViewer = $with_vote; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withIsClosed($with_closed) { | public function withStatuses(array $statuses) { | ||||
$this->isClosed = $with_closed; | $this->statuses = $statuses; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function needOptions($need_options) { | public function needOptions($need_options) { | ||||
$this->needOptions = $need_options; | $this->needOptions = $need_options; | ||||
return $this; | return $this; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
if ($this->authorPHIDs !== null) { | if ($this->authorPHIDs !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'p.authorPHID IN (%Ls)', | 'p.authorPHID IN (%Ls)', | ||||
$this->authorPHIDs); | $this->authorPHIDs); | ||||
} | } | ||||
if ($this->isClosed !== null) { | if ($this->statuses !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'p.isClosed = %d', | 'p.status IN (%Ls)', | ||||
(int)$this->isClosed); | $this->statuses); | ||||
} | } | ||||
return $where; | return $where; | ||||
} | } | ||||
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | ||||
$joins = parent::buildJoinClauseParts($conn); | $joins = parent::buildJoinClauseParts($conn); | ||||
if ($this->withVotesByViewer !== null) { | if ($this->withVotesByViewer !== null) { | ||||
$joins[] = qsprintf( | $joins[] = qsprintf( | ||||
Show All 17 Lines |