Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/query/AlmanacDeviceQuery.php
<?php | <?php | ||||
final class AlmanacDeviceQuery | final class AlmanacDeviceQuery | ||||
extends AlmanacQuery { | extends AlmanacQuery { | ||||
private $ids; | private $ids; | ||||
private $phids; | private $phids; | ||||
private $names; | private $names; | ||||
private $namePrefix; | private $namePrefix; | ||||
private $nameSuffix; | private $nameSuffix; | ||||
private $isClusterDevice; | private $isClusterDevice; | ||||
private $statuses; | |||||
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 10 Lines | public function withNamePrefix($prefix) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withNameSuffix($suffix) { | public function withNameSuffix($suffix) { | ||||
$this->nameSuffix = $suffix; | $this->nameSuffix = $suffix; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withStatuses(array $statuses) { | |||||
$this->statuses = $statuses; | |||||
return $this; | |||||
} | |||||
public function withNameNgrams($ngrams) { | public function withNameNgrams($ngrams) { | ||||
return $this->withNgramsConstraint( | return $this->withNgramsConstraint( | ||||
new AlmanacDeviceNameNgrams(), | new AlmanacDeviceNameNgrams(), | ||||
$ngrams); | $ngrams); | ||||
} | } | ||||
public function withIsClusterDevice($is_cluster_device) { | public function withIsClusterDevice($is_cluster_device) { | ||||
$this->isClusterDevice = $is_cluster_device; | $this->isClusterDevice = $is_cluster_device; | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
if ($this->isClusterDevice !== null) { | if ($this->isClusterDevice !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn, | $conn, | ||||
'device.isBoundToClusterService = %d', | 'device.isBoundToClusterService = %d', | ||||
(int)$this->isClusterDevice); | (int)$this->isClusterDevice); | ||||
} | } | ||||
if ($this->statuses !== null) { | |||||
$where[] = qsprintf( | |||||
$conn, | |||||
'device.status IN (%Ls)', | |||||
$this->statuses); | |||||
} | |||||
return $where; | return $where; | ||||
} | } | ||||
protected function getPrimaryTableAlias() { | protected function getPrimaryTableAlias() { | ||||
return 'device'; | return 'device'; | ||||
} | } | ||||
public function getOrderableColumns() { | public function getOrderableColumns() { | ||||
Show All 32 Lines |