Skip to content
Permalink
Browse files

Add index reflection into describe()

Having one method to do index + column descriptions makes Table easier
to use. It also makes it possible to use index data more easily in other
parts of the framework.
  • Loading branch information...
markstory committed May 31, 2013
1 parent a45d462 commit 25863adbfd27f7ad3028ef4b1a9749ad725f90ea
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/Cake/Database/Schema/Collection.php
@@ -90,12 +90,25 @@ public function describe($name) {
$table = new Table($name);
$fieldParams = [];
if (method_exists($this->_dialect, 'extraSchemaColumn')) {
if (method_exists($this->_dialect, 'extraSchemaColumns')) {
$fieldParams = $this->_dialect->extraSchemaColumns();
}
foreach ($statement->fetchAll('assoc') as $row) {
$this->_dialect->convertFieldDescription($table, $row, $fieldParams);
}
list($sql, $params) = $this->_dialect->describeIndexSql(
$name,
$this->_connection->config()
);
try {
$statement = $this->_connection->execute($sql, $params);
} catch (\PDOException $e) {
return null;
}
foreach ($statement->fetchAll('assoc') as $row) {
$this->_dialect->convertIndexDescription($table, $row);
}
return $table;
}

0 comments on commit 25863ad

Please sign in to comment.
You can’t perform that action at this time.