Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/query/PholioMockQuery.php
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | final class PholioMockQuery | ||||
} | } | ||||
public function needTokenCounts($need) { | public function needTokenCounts($need) { | ||||
$this->needTokenCounts = $need; | $this->needTokenCounts = $need; | ||||
return $this; | return $this; | ||||
} | } | ||||
protected function loadPage() { | protected function loadPage() { | ||||
$table = new PholioMock(); | $mocks = $this->loadStandardPage(new PholioMock()); | ||||
$conn_r = $table->establishConnection('r'); | |||||
$data = queryfx_all( | |||||
$conn_r, | |||||
'%Q FROM %T mock %Q %Q %Q %Q %Q %Q', | |||||
$this->buildSelectClause($conn_r), | |||||
$table->getTableName(), | |||||
$this->buildJoinClause($conn_r), | |||||
$this->buildWhereClause($conn_r), | |||||
$this->buildGroupClause($conn_r), | |||||
$this->buildOrderClause($conn_r), | |||||
$this->buildHavingClause($conn_r), | |||||
$this->buildLimitClause($conn_r)); | |||||
$mocks = $table->loadAllFromArray($data); | |||||
if ($mocks && $this->needImages) { | if ($mocks && $this->needImages) { | ||||
self::loadImages($this->getViewer(), $mocks, $this->needInlineComments); | self::loadImages($this->getViewer(), $mocks, $this->needInlineComments); | ||||
} | } | ||||
if ($mocks && $this->needCoverFiles) { | if ($mocks && $this->needCoverFiles) { | ||||
$this->loadCoverFiles($mocks); | $this->loadCoverFiles($mocks); | ||||
} | } | ||||
if ($mocks && $this->needTokenCounts) { | if ($mocks && $this->needTokenCounts) { | ||||
$this->loadTokenCounts($mocks); | $this->loadTokenCounts($mocks); | ||||
} | } | ||||
return $mocks; | return $mocks; | ||||
} | } | ||||
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) { | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
$where = array(); | $where = parent::buildWhereClauseParts($conn); | ||||
$where[] = $this->buildWhereClauseParts($conn_r); | |||||
if ($this->ids !== null) { | if ($this->ids !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'mock.id IN (%Ld)', | 'mock.id IN (%Ld)', | ||||
$this->ids); | $this->ids); | ||||
} | } | ||||
if ($this->phids !== null) { | if ($this->phids !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'mock.phid IN (%Ls)', | 'mock.phid IN (%Ls)', | ||||
$this->phids); | $this->phids); | ||||
} | } | ||||
if ($this->authorPHIDs !== null) { | if ($this->authorPHIDs !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'mock.authorPHID in (%Ls)', | 'mock.authorPHID in (%Ls)', | ||||
$this->authorPHIDs); | $this->authorPHIDs); | ||||
} | } | ||||
if ($this->statuses !== null) { | if ($this->statuses !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'mock.status IN (%Ls)', | 'mock.status IN (%Ls)', | ||||
$this->statuses); | $this->statuses); | ||||
} | } | ||||
return $this->formatWhereClause($where); | return $where; | ||||
} | } | ||||
public static function loadImages( | public static function loadImages( | ||||
PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
array $mocks, | array $mocks, | ||||
$need_inline_comments) { | $need_inline_comments) { | ||||
assert_instances_of($mocks, 'PholioMock'); | assert_instances_of($mocks, 'PholioMock'); | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |