Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phragment/query/PhragmentSnapshotChildQuery.php
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | $data = queryfx_all( | ||||
$table->getTableName(), | $table->getTableName(), | ||||
$this->buildWhereClause($conn_r), | $this->buildWhereClause($conn_r), | ||||
$this->buildOrderClause($conn_r), | $this->buildOrderClause($conn_r), | ||||
$this->buildLimitClause($conn_r)); | $this->buildLimitClause($conn_r)); | ||||
return $table->loadAllFromArray($data); | return $table->loadAllFromArray($data); | ||||
} | } | ||||
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClause(AphrontDatabaseConnection $conn) { | ||||
$where = array(); | $where = array(); | ||||
if ($this->ids) { | if ($this->ids) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'id IN (%Ld)', | 'id IN (%Ld)', | ||||
$this->ids); | $this->ids); | ||||
} | } | ||||
if ($this->snapshotPHIDs) { | if ($this->snapshotPHIDs) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'snapshotPHID IN (%Ls)', | 'snapshotPHID IN (%Ls)', | ||||
$this->snapshotPHIDs); | $this->snapshotPHIDs); | ||||
} | } | ||||
if ($this->fragmentPHIDs) { | if ($this->fragmentPHIDs) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'fragmentPHID IN (%Ls)', | 'fragmentPHID IN (%Ls)', | ||||
$this->fragmentPHIDs); | $this->fragmentPHIDs); | ||||
} | } | ||||
if ($this->fragmentVersionPHIDs) { | if ($this->fragmentVersionPHIDs) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'fragmentVersionPHID IN (%Ls)', | 'fragmentVersionPHID IN (%Ls)', | ||||
$this->fragmentVersionPHIDs); | $this->fragmentVersionPHIDs); | ||||
} | } | ||||
$where[] = $this->buildPagingClause($conn_r); | $where[] = $this->buildPagingClause($conn); | ||||
return $this->formatWhereClause($where); | return $this->formatWhereClause($conn, $where); | ||||
} | } | ||||
protected function willFilterPage(array $page) { | protected function willFilterPage(array $page) { | ||||
$snapshots = array(); | $snapshots = array(); | ||||
$snapshot_phids = array_filter(mpull($page, 'getSnapshotPHID')); | $snapshot_phids = array_filter(mpull($page, 'getSnapshotPHID')); | ||||
if ($snapshot_phids) { | if ($snapshot_phids) { | ||||
$snapshots = id(new PhabricatorObjectQuery()) | $snapshots = id(new PhabricatorObjectQuery()) | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |