fixture generator for new table and field level parameters

This commit is contained in:
SkieDr 2009-09-29 19:30:02 +04:00
parent a445a12020
commit 86d0a04c8d

View file

@ -260,16 +260,24 @@ class FixtureTask extends Shell {
$out = "array(\n";
foreach ($tableInfo as $field => $fieldInfo) {
if (is_array($fieldInfo)) {
if ($field != 'indexes') {
if (!in_array($field, array('indexes', 'tableParameters'))) {
$col = "\t\t'{$field}' => array('type'=>'" . $fieldInfo['type'] . "', ";
$col .= join(', ', $this->_Schema->__values($fieldInfo));
} else {
} elseif ($field == 'indexes') {
$col = "\t\t'indexes' => array(";
$props = array();
foreach ((array)$fieldInfo as $key => $index) {
$props[] = "'{$key}' => array(".join(', ', $this->_Schema->__values($index)).")";
}
$col .= join(', ', $props);
} elseif ($field == 'tableParameters') {
//@todo add charset, collate and engine here
$col = "\t\t'tableParameters' => array(";
$props = array();
foreach ((array)$fieldInfo as $key => $param) {
$props[] = "'{$key}' => '$param'";
}
$col .= join(', ', $props);
}
$col .= ")";
$cols[] = $col;