[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorConfigTableSchema 4 extends PhabricatorConfigStorageSchema { 5 6 private $collation; 7 private $columns = array(); 8 private $keys = array(); 9 10 public function addColumn(PhabricatorConfigColumnSchema $column) { 11 $key = $column->getName(); 12 if (isset($this->columns[$key])) { 13 throw new Exception( 14 pht('Trying to add duplicate column "%s"!', $key)); 15 } 16 $this->columns[$key] = $column; 17 return $this; 18 } 19 20 public function addKey(PhabricatorConfigKeySchema $key) { 21 $name = $key->getName(); 22 if (isset($this->keys[$name])) { 23 throw new Exception( 24 pht('Trying to add duplicate key "%s"!', $name)); 25 } 26 $key->setTable($this); 27 $this->keys[$name] = $key; 28 return $this; 29 } 30 31 public function getColumns() { 32 return $this->columns; 33 } 34 35 public function getColumn($key) { 36 return idx($this->getColumns(), $key); 37 } 38 39 public function getKeys() { 40 return $this->keys; 41 } 42 43 public function getKey($key) { 44 return idx($this->getKeys(), $key); 45 } 46 47 protected function getSubschemata() { 48 // NOTE: Keys and columns may have the same name, so make sure we return 49 // everything. 50 51 return array_merge( 52 array_values($this->columns), 53 array_values($this->keys)); 54 } 55 56 public function setCollation($collation) { 57 $this->collation = $collation; 58 return $this; 59 } 60 61 public function getCollation() { 62 return $this->collation; 63 } 64 65 public function compareToSimilarSchema( 66 PhabricatorConfigStorageSchema $expect) { 67 68 $issues = array(); 69 if ($this->getCollation() != $expect->getCollation()) { 70 $issues[] = self::ISSUE_COLLATION; 71 } 72 73 return $issues; 74 } 75 76 public function newEmptyClone() { 77 $clone = clone $this; 78 $clone->columns = array(); 79 $clone->keys = array(); 80 return $clone; 81 } 82 83 }
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 |