Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/schema/PhabricatorConfigTableSchema.php
Show All 17 Lines | final class PhabricatorConfigTableSchema | ||||
} | } | ||||
public function addKey(PhabricatorConfigKeySchema $key) { | public function addKey(PhabricatorConfigKeySchema $key) { | ||||
$name = $key->getName(); | $name = $key->getName(); | ||||
if (isset($this->keys[$name])) { | if (isset($this->keys[$name])) { | ||||
throw new Exception( | throw new Exception( | ||||
pht('Trying to add duplicate key "%s"!', $name)); | pht('Trying to add duplicate key "%s"!', $name)); | ||||
} | } | ||||
$key->setTable($this); | |||||
$this->keys[$name] = $key; | $this->keys[$name] = $key; | ||||
return $this; | 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() { | public function getKeys() { | ||||
return $this->keys; | return $this->keys; | ||||
} | } | ||||
public function getKey($key) { | public function getKey($key) { | ||||
return idx($this->getKeys(), $key); | return idx($this->getKeys(), $key); | ||||
} | } | ||||
protected function getSubschemata() { | protected function getSubschemata() { | ||||
return array_merge($this->getColumns(), $this->getKeys()); | // NOTE: Keys and columns may have the same name, so make sure we return | ||||
// everything. | |||||
return array_merge( | |||||
array_values($this->columns), | |||||
array_values($this->keys)); | |||||
} | } | ||||
epriestley: Fixes a bug with HeraldTranscript which had keys and columns with the same name. | |||||
public function setCollation($collation) { | public function setCollation($collation) { | ||||
$this->collation = $collation; | $this->collation = $collation; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getCollation() { | public function getCollation() { | ||||
return $this->collation; | return $this->collation; | ||||
Show All 21 Lines |
Fixes a bug with HeraldTranscript which had keys and columns with the same name.