Commit a476c62e authored by Jonathan.Wage's avatar Jonathan.Wage

Cleaned up some stuff with schema generation and removed name: key from column definition.

parent 3b898ca9
...@@ -59,22 +59,21 @@ class Doctrine_Export_Schema ...@@ -59,22 +59,21 @@ class Doctrine_Export_Schema
// we iterate trhough the diff of previously declared classes // we iterate trhough the diff of previously declared classes
// and currently declared classes // and currently declared classes
foreach ($loadedModels as $name) { foreach ($loadedModels as $className) {
if ( ! empty($models) && !in_array($name, $models)) { if ( ! empty($models) && !in_array($className, $models)) {
continue; continue;
} }
$record = new $name(); $record = new $className();
$recordTable = $record->getTable(); $recordTable = $record->getTable();
$data = $recordTable->getExportableFormat(); $data = $recordTable->getExportableFormat();
$table = array(); $table = array();
$table['tableName'] = $data['tableName'];
$table['className'] = get_class($record);
foreach ($data['columns'] AS $name => $column) { foreach ($data['columns'] AS $name => $column) {
$data['columns'][$name]['name'] = $name; $data['columns'][$name]['type'] = $column['type'] . '(' . $column['length'] . ')';
unset($data['columns'][$name]['length']);
} }
$table['columns'] = $data['columns']; $table['columns'] = $data['columns'];
...@@ -105,7 +104,7 @@ class Doctrine_Export_Schema ...@@ -105,7 +104,7 @@ class Doctrine_Export_Schema
} }
} }
$array[$table['className']] = $table; $array[$className] = $table;
} }
return $array; return $array;
......
...@@ -320,7 +320,7 @@ class Doctrine_Import_Schema ...@@ -320,7 +320,7 @@ class Doctrine_Import_Schema
if ( ! empty($columns)) { if ( ! empty($columns)) {
foreach ($columns as $columnName => $field) { foreach ($columns as $columnName => $field) {
$colDesc = array(); $colDesc = array();
$colDesc['name'] = isset($field['name']) ? (string) $field['name']:$columnName; $colDesc['name'] = $columnName;
$e = explode('(', $field['type']); $e = explode('(', $field['type']);
if (isset($e[0]) && isset($e[1])) { if (isset($e[0]) && isset($e[1])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment