3 final class PhabricatorRepositorySyncEventQuery
4 extends PhabricatorCursorPagedPolicyAwareQuery
{
8 private $repositoryPHIDs;
12 public function withIDs(array $ids) {
17 public function withPHIDs(array $phids) {
18 $this->phids
= $phids;
22 public function withRepositoryPHIDs(array $repository_phids) {
23 $this->repositoryPHIDs
= $repository_phids;
27 public function withEpochBetween($min, $max) {
28 $this->epochMin
= $min;
29 $this->epochMax
= $max;
33 public function newResultObject() {
34 return new PhabricatorRepositorySyncEvent();
37 protected function willFilterPage(array $events) {
38 $repository_phids = mpull($events, 'getRepositoryPHID');
39 $repository_phids = array_filter($repository_phids);
41 if ($repository_phids) {
42 $repositories = id(new PhabricatorRepositoryQuery())
43 ->setViewer($this->getViewer())
44 ->withPHIDs($repository_phids)
46 $repositories = mpull($repositories, null, 'getPHID');
48 $repositories = array();
51 foreach ($events as $key => $event) {
52 $phid = $event->getRepositoryPHID();
54 if (empty($repositories[$phid])) {
56 $this->didRejectResult($event);
60 $event->attachRepository($repositories[$phid]);
66 protected function buildWhereClauseParts(AphrontDatabaseConnection
$conn) {
67 $where = parent
::buildWhereClauseParts($conn);
69 if ($this->ids
!== null) {
76 if ($this->phids
!== null) {
83 if ($this->repositoryPHIDs
!== null) {
86 'repositoryPHID IN (%Ls)',
87 $this->repositoryPHIDs
);
90 if ($this->epochMin
!== null) {
97 if ($this->epochMax
!== null) {
107 public function getQueryApplicationClass() {
108 return 'PhabricatorDiffusionApplication';