2013-11-07 02:00:09 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class NuanceQueueQuery
|
|
|
|
extends NuanceQuery {
|
|
|
|
|
|
|
|
private $ids;
|
|
|
|
private $phids;
|
|
|
|
|
|
|
|
public function withIDs(array $ids) {
|
|
|
|
$this->ids = $ids;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function withPHIDs(array $phids) {
|
|
|
|
$this->phids = $phids;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2015-01-13 20:56:07 +01:00
|
|
|
protected function loadPage() {
|
2013-11-07 02:00:09 +01:00
|
|
|
$table = new NuanceQueue();
|
2015-06-05 19:43:37 +02:00
|
|
|
$conn = $table->establishConnection('r');
|
2013-11-07 02:00:09 +01:00
|
|
|
|
|
|
|
$data = queryfx_all(
|
2015-06-05 19:43:37 +02:00
|
|
|
$conn,
|
|
|
|
'%Q FROM %T %Q %Q %Q',
|
|
|
|
$this->buildSelectClause($conn),
|
2013-11-07 02:00:09 +01:00
|
|
|
$table->getTableName(),
|
2015-06-05 19:43:37 +02:00
|
|
|
$this->buildWhereClause($conn),
|
|
|
|
$this->buildOrderClause($conn),
|
|
|
|
$this->buildLimitClause($conn));
|
2013-11-07 02:00:09 +01:00
|
|
|
|
|
|
|
return $table->loadAllFromArray($data);
|
|
|
|
}
|
|
|
|
|
2015-06-05 19:43:37 +02:00
|
|
|
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
|
|
|
|
$where = parent::buildWhereClauseParts($conn);
|
2013-11-07 02:00:09 +01:00
|
|
|
|
2015-06-05 19:43:37 +02:00
|
|
|
if ($this->ids !== null) {
|
2013-11-07 02:00:09 +01:00
|
|
|
$where[] = qsprintf(
|
2015-06-05 19:43:37 +02:00
|
|
|
$conn,
|
2013-11-07 02:00:09 +01:00
|
|
|
'id IN (%Ld)',
|
|
|
|
$this->ids);
|
|
|
|
}
|
|
|
|
|
2015-06-05 19:43:37 +02:00
|
|
|
if ($this->phids !== null) {
|
2013-11-07 02:00:09 +01:00
|
|
|
$where[] = qsprintf(
|
2015-06-05 19:43:37 +02:00
|
|
|
$conn,
|
2013-11-07 02:00:09 +01:00
|
|
|
'phid IN (%Ls)',
|
|
|
|
$this->phids);
|
|
|
|
}
|
|
|
|
|
2015-06-05 19:43:37 +02:00
|
|
|
return $where;
|
2013-11-07 02:00:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|