Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/query/DiffusionDiffInlineCommentQuery.php
<?php | <?php | ||||
final class DiffusionDiffInlineCommentQuery | final class DiffusionDiffInlineCommentQuery | ||||
extends PhabricatorDiffInlineCommentQuery { | extends PhabricatorDiffInlineCommentQuery { | ||||
private $commitPHIDs; | private $commitPHIDs; | ||||
private $hasPath; | |||||
private $pathIDs; | private $pathIDs; | ||||
protected function newApplicationTransactionCommentTemplate() { | |||||
return new PhabricatorAuditTransactionComment(); | |||||
} | |||||
public function withCommitPHIDs(array $phids) { | public function withCommitPHIDs(array $phids) { | ||||
$this->commitPHIDs = $phids; | $this->commitPHIDs = $phids; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withHasPath($has_path) { | public function withObjectPHIDs(array $phids) { | ||||
$this->hasPath = $has_path; | return $this->withCommitPHIDs($phids); | ||||
return $this; | |||||
} | } | ||||
public function withPathIDs(array $path_ids) { | public function withPathIDs(array $path_ids) { | ||||
$this->pathIDs = $path_ids; | $this->pathIDs = $path_ids; | ||||
return $this; | return $this; | ||||
} | } | ||||
protected function getTemplate() { | protected function buildInlineCommentWhereClauseParts( | ||||
return new PhabricatorAuditTransactionComment(); | AphrontDatabaseConnection $conn) { | ||||
$where = array(); | |||||
$alias = $this->getPrimaryTableAlias(); | |||||
$where[] = qsprintf( | |||||
$conn, | |||||
'%T.pathID IS NOT NULL', | |||||
$alias); | |||||
return $where; | |||||
} | } | ||||
protected function buildWhereClauseComponents( | protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) { | ||||
AphrontDatabaseConnection $conn_r) { | $where = parent::buildWhereClauseParts($conn); | ||||
$where = parent::buildWhereClauseComponents($conn_r); | $alias = $this->getPrimaryTableAlias(); | ||||
if ($this->commitPHIDs !== null) { | if ($this->commitPHIDs !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'xcomment.commitPHID IN (%Ls)', | '%T.commitPHID IN (%Ls)', | ||||
$alias, | |||||
$this->commitPHIDs); | $this->commitPHIDs); | ||||
} | } | ||||
if ($this->hasPath !== null) { | |||||
if ($this->hasPath) { | |||||
$where[] = qsprintf( | |||||
$conn_r, | |||||
'xcomment.pathID IS NOT NULL'); | |||||
} else { | |||||
$where[] = qsprintf( | |||||
$conn_r, | |||||
'xcomment.pathID IS NULL'); | |||||
} | |||||
} | |||||
if ($this->pathIDs !== null) { | if ($this->pathIDs !== null) { | ||||
$where[] = qsprintf( | $where[] = qsprintf( | ||||
$conn_r, | $conn, | ||||
'xcomment.pathID IN (%Ld)', | '%T.pathID IN (%Ld)', | ||||
$alias, | |||||
$this->pathIDs); | $this->pathIDs); | ||||
} | } | ||||
return $where; | return $where; | ||||
} | } | ||||
} | } |