[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorMailingListQuery 4 extends PhabricatorCursorPagedPolicyAwareQuery { 5 6 private $phids; 7 private $ids; 8 private $emails; 9 private $names; 10 11 public function withIDs($ids) { 12 $this->ids = $ids; 13 return $this; 14 } 15 16 public function withPHIDs($phids) { 17 $this->phids = $phids; 18 return $this; 19 } 20 21 public function withEmails(array $emails) { 22 $this->emails = $emails; 23 return $this; 24 } 25 26 public function withNames(array $names) { 27 $this->names = $names; 28 return $this; 29 } 30 31 public function loadPage() { 32 $table = new PhabricatorMetaMTAMailingList(); 33 $conn_r = $table->establishConnection('r'); 34 35 $data = queryfx_all( 36 $conn_r, 37 'SELECT * FROM %T %Q %Q %Q', 38 $table->getTableName(), 39 $this->buildWhereClause($conn_r), 40 $this->buildOrderClause($conn_r), 41 $this->buildLimitClause($conn_r)); 42 43 return $table->loadAllFromArray($data); 44 } 45 46 private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 47 $where = array(); 48 49 if ($this->ids) { 50 $where[] = qsprintf( 51 $conn_r, 52 'id IN (%Ld)', 53 $this->ids); 54 } 55 56 if ($this->phids) { 57 $where[] = qsprintf( 58 $conn_r, 59 'phid IN (%Ls)', 60 $this->phids); 61 } 62 63 if ($this->names) { 64 $where[] = qsprintf( 65 $conn_r, 66 'name IN (%Ls)', 67 $this->names); 68 } 69 70 if ($this->emails) { 71 $where[] = qsprintf( 72 $conn_r, 73 'email IN (%Ls)', 74 $this->emails); 75 } 76 77 $where[] = $this->buildPagingClause($conn_r); 78 79 return $this->formatWhereClause($where); 80 } 81 82 public function getQueryApplicationClass() { 83 return 'PhabricatorMailingListsApplication'; 84 } 85 86 }
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 |