Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/query/PhabricatorProjectColumnQuery.php
<?php | <?php | ||||
final class PhabricatorProjectColumnQuery | final class PhabricatorProjectColumnQuery | ||||
extends PhabricatorCursorPagedPolicyAwareQuery { | extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
private $ids; | private $ids; | ||||
private $phids; | private $phids; | ||||
private $projectPHIDs; | private $projectPHIDs; | ||||
private $statuses; | private $statuses; | ||||
private $names; | |||||
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 withProjectPHIDs(array $project_phids) { | public function withProjectPHIDs(array $project_phids) { | ||||
$this->projectPHIDs = $project_phids; | $this->projectPHIDs = $project_phids; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withStatuses(array $status) { | public function withStatuses(array $status) { | ||||
$this->statuses = $status; | $this->statuses = $status; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withNames(array $names) { | |||||
$this->names = $names; | |||||
return $this; | |||||
} | |||||
protected function loadPage() { | protected function loadPage() { | ||||
$table = new PhabricatorProjectColumn(); | $table = new PhabricatorProjectColumn(); | ||||
$conn_r = $table->establishConnection('r'); | $conn_r = $table->establishConnection('r'); | ||||
$data = queryfx_all( | $data = queryfx_all( | ||||
$conn_r, | $conn_r, | ||||
'SELECT * FROM %T %Q %Q %Q', | 'SELECT * FROM %T %Q %Q %Q', | ||||
$table->getTableName(), | $table->getTableName(), | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | private function buildWhereClause($conn_r) { | ||||
if ($this->statuses !== null) { | if ($this->statuses !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn_r, | ||||
'status IN (%Ld)', | 'status IN (%Ld)', | ||||
$this->statuses); | $this->statuses); | ||||
} | } | ||||
if ($this->names) { | |||||
$where[] = qsprintf( | |||||
$conn_r, | |||||
'name IN (%Ls)', | |||||
$this->names); | |||||
} | |||||
$where[] = $this->buildPagingClause($conn_r); | $where[] = $this->buildPagingClause($conn_r); | ||||
return $this->formatWhereClause($where); | return $this->formatWhereClause($where); | ||||
} | } | ||||
public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
return 'PhabricatorApplicationProject'; | return 'PhabricatorApplicationProject'; | ||||
} | } | ||||
} | } |