Changeset View
Changeset View
Standalone View
Standalone View
src/applications/drydock/query/DrydockLeaseQuery.php
<?php | <?php | ||||
final class DrydockLeaseQuery extends DrydockQuery { | final class DrydockLeaseQuery extends DrydockQuery { | ||||
private $ids; | private $ids; | ||||
private $phids; | private $phids; | ||||
private $resourcePHIDs; | private $resourcePHIDs; | ||||
private $ownerPHIDs; | private $ownerPHIDs; | ||||
private $statuses; | private $statuses; | ||||
private $datasourceQuery; | private $datasourceQuery; | ||||
private $needUnconsumedCommands; | private $needUnconsumedCommands; | ||||
private $minModified; | |||||
private $maxModified; | |||||
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; | ||||
Show All 15 Lines | public function withStatuses(array $statuses) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withDatasourceQuery($query) { | public function withDatasourceQuery($query) { | ||||
$this->datasourceQuery = $query; | $this->datasourceQuery = $query; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withDateModifiedBetween($min_epoch, $max_epoch) { | |||||
$this->minModified = $min_epoch; | |||||
$this->maxModified = $max_epoch; | |||||
return $this; | |||||
} | |||||
public function needUnconsumedCommands($need) { | public function needUnconsumedCommands($need) { | ||||
$this->needUnconsumedCommands = $need; | $this->needUnconsumedCommands = $need; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function newResultObject() { | public function newResultObject() { | ||||
return new DrydockLease(); | return new DrydockLease(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 90 Lines • ▼ Show 20 Lines | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
if ($this->datasourceQuery !== null) { | if ($this->datasourceQuery !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'id = %d', | 'id = %d', | ||||
(int)$this->datasourceQuery); | (int)$this->datasourceQuery); | ||||
} | } | ||||
if ($this->minModified !== null) { | |||||
$where[] = qsprintf( | |||||
$conn, | |||||
'dateModified >= %d', | |||||
$this->minModified); | |||||
} | |||||
if ($this->maxModified !== null) { | |||||
$where[] = qsprintf( | |||||
$conn, | |||||
'dateModified <= %d', | |||||
$this->maxModified); | |||||
} | |||||
return $where; | return $where; | ||||
} | } | ||||
} | } |