[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/harbormaster/query/ -> HarbormasterBuildItemQuery.php (source)

   1  <?php
   2  
   3  final class HarbormasterBuildItemQuery
   4    extends PhabricatorCursorPagedPolicyAwareQuery {
   5  
   6    private $ids;
   7    private $phids;
   8  
   9    public function withIDs(array $ids) {
  10      $this->ids = $ids;
  11      return $this;
  12    }
  13  
  14    public function withPHIDs(array $phids) {
  15      $this->phids = $phids;
  16      return $this;
  17    }
  18  
  19    protected function loadPage() {
  20      $table = new HarbormasterBuildItem();
  21      $conn_r = $table->establishConnection('r');
  22  
  23      $data = queryfx_all(
  24        $conn_r,
  25        'SELECT * FROM %T %Q %Q %Q',
  26        $table->getTableName(),
  27        $this->buildWhereClause($conn_r),
  28        $this->buildOrderClause($conn_r),
  29        $this->buildLimitClause($conn_r));
  30  
  31      return $table->loadAllFromArray($data);
  32    }
  33  
  34    private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
  35      $where = array();
  36  
  37      if ($this->ids) {
  38        $where[] = qsprintf(
  39          $conn_r,
  40          'id IN (%Ld)',
  41          $this->ids);
  42      }
  43  
  44      if ($this->phids) {
  45        $where[] = qsprintf(
  46          $conn_r,
  47          'phid in (%Ls)',
  48          $this->phids);
  49      }
  50  
  51      $where[] = $this->buildPagingClause($conn_r);
  52  
  53      return $this->formatWhereClause($where);
  54    }
  55  
  56    public function getQueryApplicationClass() {
  57      return 'PhabricatorHarbormasterApplication';
  58    }
  59  
  60  }


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