[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/chatlog/query/ -> PhabricatorChatLogChannelQuery.php (source)

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


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