[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/transactions/query/ -> PhabricatorApplicationTransactionCommentQuery.php (source)

   1  <?php
   2  
   3  final class PhabricatorApplicationTransactionCommentQuery
   4    extends PhabricatorCursorPagedPolicyAwareQuery {
   5  
   6    private $template;
   7  
   8    private $phids;
   9    private $transactionPHIDs;
  10  
  11    public function setTemplate(
  12      PhabricatorApplicationTransactionComment $template) {
  13      $this->template = $template;
  14      return $this;
  15    }
  16  
  17    public function withPHIDs(array $phids) {
  18      $this->phids = $phids;
  19      return $this;
  20    }
  21  
  22    public function withTransactionPHIDs(array $transaction_phids) {
  23      $this->transactionPHIDs = $transaction_phids;
  24      return $this;
  25    }
  26  
  27    protected function loadPage() {
  28      $table = $this->template;
  29      $conn_r = $table->establishConnection('r');
  30  
  31      $data = queryfx_all(
  32        $conn_r,
  33        'SELECT * FROM %T xc %Q %Q %Q',
  34        $table->getTableName(),
  35        $this->buildWhereClause($conn_r),
  36        $this->buildOrderClause($conn_r),
  37        $this->buildLimitClause($conn_r));
  38  
  39      return $table->loadAllFromArray($data);
  40    }
  41  
  42    private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
  43      $where = array();
  44  
  45      if ($this->phids) {
  46        $where[] = qsprintf(
  47          $conn_r,
  48          'phid IN (%Ls)',
  49          $this->phids);
  50      }
  51  
  52      if ($this->transactionPHIDs) {
  53        $where[] = qsprintf(
  54          $conn_r,
  55          'transactionPHID IN (%Ls)',
  56          $this->transactionPHIDs);
  57      }
  58  
  59      return $this->formatWhereClause($where);
  60    }
  61  
  62    public function getQueryApplicationClass() {
  63      // TODO: Figure out the app via the template?
  64      return null;
  65    }
  66  
  67  
  68  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1