[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/nuance/query/ -> NuanceItemQuery.php (source)

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


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