Extend TransactionCommentQuery for Differential

Summary: Ref T2009. Ref T1460. Replace hard-coded garbage with a real Query-layer query.

Test Plan: Submitted inline comments in Differential.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2009, T1460

Differential Revision: https://secure.phabricator.com/D12027
This commit is contained in:
epriestley
2015-03-09 12:40:29 -07:00
parent 4d86d51125
commit 7427a6e648
5 changed files with 121 additions and 33 deletions

View File

@@ -8,6 +8,7 @@ abstract class PhabricatorApplicationTransactionCommentQuery
private $phids;
private $transactionPHIDs;
private $isDeleted;
private $hasTransaction;
abstract protected function getTemplate();
@@ -31,11 +32,16 @@ abstract class PhabricatorApplicationTransactionCommentQuery
return $this;
}
public function withDeleted($deleted) {
public function withIsDeleted($deleted) {
$this->isDeleted = $deleted;
return $this;
}
public function withHasTransaction($has_transaction) {
$this->hasTransaction = $has_transaction;
return $this;
}
protected function loadPage() {
$table = $this->getTemplate();
$conn_r = $table->establishConnection('r');
@@ -51,7 +57,13 @@ abstract class PhabricatorApplicationTransactionCommentQuery
return $table->loadAllFromArray($data);
}
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
return $this->formatWhereClause($this->buildWhereClauseComponents($conn_r));
}
protected function buildWhereClauseComponents(
AphrontDatabaseConnection $conn_r) {
$where = array();
if ($this->ids !== null) {
@@ -89,7 +101,19 @@ abstract class PhabricatorApplicationTransactionCommentQuery
(int)$this->isDeleted);
}
return $this->formatWhereClause($where);
if ($this->hasTransaction !== null) {
if ($this->hasTransaction) {
$where[] = qsprintf(
$conn_r,
'xcomment.transactionPHID IS NOT NULL');
} else {
$where[] = qsprintf(
$conn_r,
'xcomment.transactionPHID IS NULL');
}
}
return $where;
}
public function getQueryApplicationClass() {