Differential D18970 Diff 45502 src/applications/repository/query/PhabricatorRepositoryPullEventQuery.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/query/PhabricatorRepositoryPullEventQuery.php
| <?php | <?php | ||||
| final class PhabricatorRepositoryPullEventQuery | final class PhabricatorRepositoryPullEventQuery | ||||
| extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
| private $ids; | private $ids; | ||||
| private $phids; | private $phids; | ||||
| private $repositoryPHIDs; | private $repositoryPHIDs; | ||||
| private $pullerPHIDs; | private $pullerPHIDs; | ||||
| private $epochMin; | |||||
| private $epochMax; | |||||
| 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) { | public function withPHIDs(array $phids) { | ||||
| $this->phids = $phids; | $this->phids = $phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withRepositoryPHIDs(array $repository_phids) { | public function withRepositoryPHIDs(array $repository_phids) { | ||||
| $this->repositoryPHIDs = $repository_phids; | $this->repositoryPHIDs = $repository_phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withPullerPHIDs(array $puller_phids) { | public function withPullerPHIDs(array $puller_phids) { | ||||
| $this->pullerPHIDs = $puller_phids; | $this->pullerPHIDs = $puller_phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withEpochBetween($min, $max) { | |||||
| $this->epochMin = $min; | |||||
| $this->epochMax = $max; | |||||
| return $this; | |||||
| } | |||||
| public function newResultObject() { | public function newResultObject() { | ||||
| return new PhabricatorRepositoryPullEvent(); | return new PhabricatorRepositoryPullEvent(); | ||||
| } | } | ||||
| protected function loadPage() { | protected function loadPage() { | ||||
| return $this->loadStandardPage($this->newResultObject()); | return $this->loadStandardPage($this->newResultObject()); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
| if ($this->pullerPHIDs !== null) { | if ($this->pullerPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn, | $conn, | ||||
| 'pullerPHID in (%Ls)', | 'pullerPHID in (%Ls)', | ||||
| $this->pullerPHIDs); | $this->pullerPHIDs); | ||||
| } | } | ||||
| if ($this->epochMin !== null) { | |||||
| $where[] = qsprintf( | |||||
| $conn, | |||||
| 'epoch >= %d', | |||||
| $this->epochMin); | |||||
| } | |||||
| if ($this->epochMax !== null) { | |||||
| $where[] = qsprintf( | |||||
| $conn, | |||||
| 'epoch <= %d', | |||||
| $this->epochMax); | |||||
| } | |||||
| return $where; | return $where; | ||||
| } | } | ||||
| public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
| return 'PhabricatorDiffusionApplication'; | return 'PhabricatorDiffusionApplication'; | ||||
| } | } | ||||
| } | } | ||||