[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/herald/query/ -> HeraldEditLogQuery.php (source)

   1  <?php
   2  
   3  final class HeraldEditLogQuery extends PhabricatorOffsetPagedQuery {
   4  
   5    private $ruleIDs;
   6  
   7    public function withRuleIDs(array $rule_ids) {
   8      $this->ruleIDs = $rule_ids;
   9      return $this;
  10    }
  11  
  12    public function execute() {
  13      $table = new HeraldRuleEdit();
  14      $conn_r = $table->establishConnection('r');
  15  
  16      $where = $this->buildWhereClause($conn_r);
  17      $order = $this->buildOrderClause($conn_r);
  18      $limit = $this->buildLimitClause($conn_r);
  19  
  20      $data = queryfx_all(
  21        $conn_r,
  22        'SELECT log.* FROM %T log %Q %Q %Q',
  23        $table->getTableName(),
  24        $where,
  25        $order,
  26        $limit);
  27  
  28      return $table->loadAllFromArray($data);
  29    }
  30  
  31    private function buildWhereClause($conn_r) {
  32      $where = array();
  33  
  34      if ($this->ruleIDs) {
  35        $where[] = qsprintf(
  36          $conn_r,
  37          'ruleID IN (%Ld)',
  38          $this->ruleIDs);
  39      }
  40  
  41      return $this->formatWhereClause($where);
  42    }
  43  
  44    private function buildOrderClause($conn_r) {
  45      return 'ORDER BY id DESC';
  46    }
  47  
  48  }


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