Changeset View
Changeset View
Standalone View
Standalone View
src/applications/doorkeeper/query/DoorkeeperExternalObjectQuery.php
| Show All 10 Lines | public function withPHIDs(array $phids) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function withObjectKeys(array $keys) { | public function withObjectKeys(array $keys) { | ||||
| $this->objectKeys = $keys; | $this->objectKeys = $keys; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| protected function loadPage() { | public function newResultObject() { | ||||
| $table = new DoorkeeperExternalObject(); | return new DoorkeeperExternalObject(); | ||||
| $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 buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
| $where = array(); | $where = parent::buildWhereClauseParts($conn); | ||||
| 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->objectKeys) { | if ($this->objectKeys !== null) { | ||||
| $where[] = qsprintf( | $where[] = qsprintf( | ||||
| $conn_r, | $conn, | ||||
| 'objectKey IN (%Ls)', | 'objectKey IN (%Ls)', | ||||
| $this->objectKeys); | $this->objectKeys); | ||||
| } | } | ||||
| $where[] = $this->buildPagingClause($conn_r); | return $where; | ||||
| return $this->formatWhereClause($where); | |||||
| } | } | ||||
| public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
| return 'PhabricatorDoorkeeperApplication'; | return 'PhabricatorDoorkeeperApplication'; | ||||
| } | } | ||||
| } | } | ||||