[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhameBlogQuery extends PhabricatorCursorPagedPolicyAwareQuery { 4 5 private $ids; 6 private $phids; 7 private $domain; 8 private $needBloggers; 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 withDomain($domain) { 21 $this->domain = $domain; 22 return $this; 23 } 24 25 protected function loadPage() { 26 $table = new PhameBlog(); 27 $conn_r = $table->establishConnection('r'); 28 29 $where_clause = $this->buildWhereClause($conn_r); 30 $order_clause = $this->buildOrderClause($conn_r); 31 $limit_clause = $this->buildLimitClause($conn_r); 32 33 $data = queryfx_all( 34 $conn_r, 35 'SELECT * FROM %T b %Q %Q %Q', 36 $table->getTableName(), 37 $where_clause, 38 $order_clause, 39 $limit_clause); 40 41 $blogs = $table->loadAllFromArray($data); 42 43 return $blogs; 44 } 45 46 private function buildWhereClause($conn_r) { 47 $where = array(); 48 49 if ($this->ids) { 50 $where[] = qsprintf( 51 $conn_r, 52 'id IN (%Ls)', 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->domain) { 64 $where[] = qsprintf( 65 $conn_r, 66 'domain = %s', 67 $this->domain); 68 } 69 70 $where[] = $this->buildPagingClause($conn_r); 71 72 return $this->formatWhereClause($where); 73 } 74 75 public function getQueryApplicationClass() { 76 // TODO: Can we set this without breaking public blogs? 77 return null; 78 } 79 80 }
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 |