Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/schema/PhabricatorConfigTableSchema.php
<?php | <?php | ||||
final class PhabricatorConfigTableSchema | final class PhabricatorConfigTableSchema | ||||
extends PhabricatorConfigStorageSchema { | extends PhabricatorConfigStorageSchema { | ||||
private $collation; | private $collation; | ||||
private $columns = array(); | private $columns = array(); | ||||
private $keys = array(); | |||||
public function addColumn(PhabricatorConfigColumnSchema $column) { | public function addColumn(PhabricatorConfigColumnSchema $column) { | ||||
$key = $column->getName(); | $key = $column->getName(); | ||||
if (isset($this->columns[$key])) { | if (isset($this->columns[$key])) { | ||||
throw new Exception( | throw new Exception( | ||||
pht('Trying to add duplicate column "%s"!', $key)); | pht('Trying to add duplicate column "%s"!', $key)); | ||||
} | } | ||||
$this->columns[$key] = $column; | $this->columns[$key] = $column; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function addKey(PhabricatorConfigKeySchema $key) { | |||||
$name = $key->getName(); | |||||
if (isset($this->keys[$name])) { | |||||
throw new Exception( | |||||
pht('Trying to add duplicate key "%s"!', $name)); | |||||
} | |||||
$this->keys[$name] = $key; | |||||
return $this; | |||||
} | |||||
public function getColumns() { | public function getColumns() { | ||||
return $this->columns; | return $this->columns; | ||||
} | } | ||||
public function getColumn($key) { | public function getColumn($key) { | ||||
return idx($this->getColumns(), $key); | return idx($this->getColumns(), $key); | ||||
} | } | ||||
public function getKeys() { | |||||
return $this->keys; | |||||
} | |||||
public function getKey($key) { | |||||
return idx($this->getKeys(), $key); | |||||
} | |||||
protected function getSubschemata() { | protected function getSubschemata() { | ||||
return $this->getColumns(); | return array_merge($this->getColumns(), $this->getKeys()); | ||||
} | } | ||||
public function setCollation($collation) { | public function setCollation($collation) { | ||||
$this->collation = $collation; | $this->collation = $collation; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getCollation() { | public function getCollation() { | ||||
Show All 9 Lines | public function compareToSimilarSchema( | ||||
} | } | ||||
return $issues; | return $issues; | ||||
} | } | ||||
public function newEmptyClone() { | public function newEmptyClone() { | ||||
$clone = clone $this; | $clone = clone $this; | ||||
$clone->columns = array(); | $clone->columns = array(); | ||||
$clone->keys = array(); | |||||
return $clone; | return $clone; | ||||
} | } | ||||
} | } |