[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class DrydockBlueprintQuery extends DrydockQuery { 4 5 private $ids; 6 private $phids; 7 8 public function withIDs(array $ids) { 9 $this->ids = $ids; 10 return $this; 11 } 12 13 public function withPHIDs(array $phids) { 14 $this->phids = $phids; 15 return $this; 16 } 17 18 public function loadPage() { 19 $table = new DrydockBlueprint(); 20 $conn_r = $table->establishConnection('r'); 21 22 $data = queryfx_all( 23 $conn_r, 24 'SELECT blueprint.* FROM %T blueprint %Q %Q %Q', 25 $table->getTableName(), 26 $this->buildWhereClause($conn_r), 27 $this->buildOrderClause($conn_r), 28 $this->buildLimitClause($conn_r)); 29 30 $blueprints = $table->loadAllFromArray($data); 31 32 $implementations = 33 DrydockBlueprintImplementation::getAllBlueprintImplementations(); 34 35 foreach ($blueprints as $blueprint) { 36 if (array_key_exists($blueprint->getClassName(), $implementations)) { 37 $blueprint->attachImplementation( 38 $implementations[$blueprint->getClassName()]); 39 } 40 } 41 42 return $blueprints; 43 } 44 45 private function buildWhereClause(AphrontDatabaseConnection $conn_r) { 46 $where = array(); 47 48 if ($this->ids) { 49 $where[] = qsprintf( 50 $conn_r, 51 'id IN (%Ld)', 52 $this->ids); 53 } 54 55 if ($this->phids) { 56 $where[] = qsprintf( 57 $conn_r, 58 'phid IN (%Ls)', 59 $this->phids); 60 } 61 62 return $this->formatWhereClause($where); 63 } 64 65 }
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 |