[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/diffusion/query/ -> DiffusionPathQuery.php (source)

   1  <?php
   2  
   3  final class DiffusionPathQuery {
   4  
   5    private $pathIDs;
   6  
   7    public function withPathIDs(array $path_ids) {
   8      $this->pathIDs = $path_ids;
   9      return $this;
  10    }
  11  
  12    public function execute() {
  13      $conn_r = id(new PhabricatorRepository())->establishConnection('r');
  14  
  15      $where = $this->buildWhereClause($conn_r);
  16  
  17      $results = queryfx_all(
  18        $conn_r,
  19        'SELECT * FROM %T %Q',
  20        PhabricatorRepository::TABLE_PATH,
  21        $where);
  22  
  23      return ipull($results, null, 'id');
  24    }
  25  
  26    private function buildWhereClause($conn_r) {
  27      $where = array();
  28  
  29      if ($this->pathIDs) {
  30        $where[] = qsprintf(
  31          $conn_r,
  32          'id IN (%Ld)',
  33          $this->pathIDs);
  34      }
  35  
  36      if ($where) {
  37        return 'WHERE ('.implode(') AND (', $where).')';
  38      } else {
  39        return '';
  40      }
  41    }
  42  
  43  }


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