[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/doorkeeper/query/ -> DoorkeeperExternalObjectQuery.php (source)

   1  <?php
   2  
   3  final class DoorkeeperExternalObjectQuery
   4    extends PhabricatorCursorPagedPolicyAwareQuery {
   5  
   6    protected $phids;
   7    protected $objectKeys;
   8  
   9    public function withPHIDs(array $phids) {
  10      $this->phids = $phids;
  11      return $this;
  12    }
  13  
  14    public function withObjectKeys(array $keys) {
  15      $this->objectKeys = $keys;
  16      return $this;
  17    }
  18  
  19    public function loadPage() {
  20      $table = new DoorkeeperExternalObject();
  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->phids) {
  38        $where[] = qsprintf(
  39          $conn_r,
  40          'phid IN (%Ls)',
  41          $this->phids);
  42      }
  43  
  44      if ($this->objectKeys) {
  45        $where[] = qsprintf(
  46          $conn_r,
  47          'objectKey IN (%Ls)',
  48          $this->objectKeys);
  49      }
  50  
  51      $where[] = $this->buildPagingClause($conn_r);
  52      return $this->formatWhereClause($where);
  53    }
  54  
  55    public function getQueryApplicationClass() {
  56      return 'PhabricatorDoorkeeperApplication';
  57    }
  58  
  59  }


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