Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/query/HarbormasterBuildLogQuery.php
| Show All 17 Lines | public function withPHIDs(array $phids) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withBuildTargetPHIDs(array $build_target_phids) { | public function withBuildTargetPHIDs(array $build_target_phids) { | ||||
| $this->buildTargetPHIDs = $build_target_phids; | $this->buildTargetPHIDs = $build_target_phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| protected function loadPage() { | public function newResultObject() { | ||||
| $table = new HarbormasterBuildLog(); | return new HarbormasterBuildLog(); | ||||
| $conn_r = $table->establishConnection('r'); | } | ||||
| $data = queryfx_all( | |||||
| $conn_r, | |||||
| 'SELECT * FROM %T %Q %Q %Q', | |||||
| $table->getTableName(), | |||||
| $this->buildWhereClause($conn_r), | |||||
| $this->buildOrderClause($conn_r), | |||||
| $this->buildLimitClause($conn_r)); | |||||
| return $table->loadAllFromArray($data); | protected function loadPage() { | ||||
| return $this->loadStandardPage($this->newResultObject()); | |||||
| } | } | ||||
| protected function willFilterPage(array $page) { | protected function willFilterPage(array $page) { | ||||
| $build_targets = array(); | $build_targets = array(); | ||||
| $build_target_phids = array_filter(mpull($page, 'getBuildTargetPHID')); | $build_target_phids = array_filter(mpull($page, 'getBuildTargetPHID')); | ||||
| if ($build_target_phids) { | if ($build_target_phids) { | ||||
| $build_targets = id(new HarbormasterBuildTargetQuery()) | $build_targets = id(new HarbormasterBuildTargetQuery()) | ||||
| Show All 11 Lines | foreach ($page as $key => $build_log) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $build_log->attachBuildTarget($build_targets[$build_target_phid]); | $build_log->attachBuildTarget($build_targets[$build_target_phid]); | ||||
| } | } | ||||
| return $page; | return $page; | ||||
| } | } | ||||
| protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = parent::buildWhereClauseParts($conn); | ||||
| if ($this->ids) { | if ($this->ids !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'id IN (%Ld)', | 'id IN (%Ld)', | ||||
| $this->ids); | $this->ids); | ||||
| } | } | ||||
| if ($this->phids) { | if ($this->phids !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'phid IN (%Ls)', | 'phid IN (%Ls)', | ||||
| $this->phids); | $this->phids); | ||||
| } | } | ||||
| if ($this->buildTargetPHIDs) { | if ($this->buildTargetPHIDs !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'buildTargetPHID IN (%Ls)', | 'buildTargetPHID IN (%Ls)', | ||||
| $this->buildTargetPHIDs); | $this->buildTargetPHIDs); | ||||
| } | } | ||||
| $where[] = $this->buildPagingClause($conn_r); | return $where; | ||||
| return $this->formatWhereClause($where); | |||||
| } | } | ||||
| public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
| return 'PhabricatorHarbormasterApplication'; | return 'PhabricatorHarbormasterApplication'; | ||||
| } | } | ||||
| } | } | ||||