[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhluxVariableQuery 4 extends PhabricatorCursorPagedPolicyAwareQuery { 5 6 private $keys; 7 private $phids; 8 9 public function withPHIDs(array $phids) { 10 $this->phids = $phids; 11 return $this; 12 } 13 14 public function withKeys(array $keys) { 15 $this->keys = $keys; 16 return $this; 17 } 18 19 protected function loadPage() { 20 $table = new PhluxVariable(); 21 $conn_r = $table->establishConnection('r'); 22 23 $rows = 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($rows); 32 } 33 34 private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 35 $where = array(); 36 37 $where[] = $this->buildPagingClause($conn_r); 38 39 if ($this->keys) { 40 $where[] = qsprintf( 41 $conn_r, 42 'variableKey IN (%Ls)', 43 $this->keys); 44 } 45 46 if ($this->phids) { 47 $where[] = qsprintf( 48 $conn_r, 49 'phid IN (%Ls)', 50 $this->phids); 51 } 52 53 return $this->formatWhereClause($where); 54 } 55 56 protected function getPagingColumn() { 57 return 'variableKey'; 58 } 59 60 protected function getPagingValue($result) { 61 return $result->getVariableKey(); 62 } 63 64 protected function getReversePaging() { 65 return true; 66 } 67 68 public function getQueryApplicationClass() { 69 return 'PhabricatorPhluxApplication'; 70 } 71 72 }
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 |