[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class AlmanacServiceQuery 4 extends AlmanacQuery { 5 6 private $ids; 7 private $phids; 8 private $names; 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 withNames(array $names) { 21 $this->names = $names; 22 return $this; 23 } 24 25 protected function loadPage() { 26 $table = new AlmanacService(); 27 $conn_r = $table->establishConnection('r'); 28 29 $data = queryfx_all( 30 $conn_r, 31 'SELECT * FROM %T %Q %Q %Q', 32 $table->getTableName(), 33 $this->buildWhereClause($conn_r), 34 $this->buildOrderClause($conn_r), 35 $this->buildLimitClause($conn_r)); 36 37 return $table->loadAllFromArray($data); 38 } 39 40 protected function buildWhereClause($conn_r) { 41 $where = array(); 42 43 if ($this->ids !== null) { 44 $where[] = qsprintf( 45 $conn_r, 46 'id IN (%Ld)', 47 $this->ids); 48 } 49 50 if ($this->phids !== null) { 51 $where[] = qsprintf( 52 $conn_r, 53 'phid IN (%Ls)', 54 $this->phids); 55 } 56 57 if ($this->names !== null) { 58 $hashes = array(); 59 foreach ($this->names as $name) { 60 $hashes[] = PhabricatorHash::digestForIndex($name); 61 } 62 63 $where[] = qsprintf( 64 $conn_r, 65 'nameIndex IN (%Ls)', 66 $hashes); 67 } 68 69 $where[] = $this->buildPagingClause($conn_r); 70 71 return $this->formatWhereClause($where); 72 } 73 74 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |