Skip to content
Permalink
Browse files

fixture generator for new table and field level parameters

  • Loading branch information...
skie committed Sep 29, 2009
1 parent a445a12 commit 86d0a04c8dd69569d7f93882b4e7ba4f4e5bf7b9
Showing with 10 additions and 2 deletions.
  1. +10 −2 cake/console/libs/tasks/fixture.php
@@ -260,16 +260,24 @@ function _generateSchema($tableInfo) {
$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;

0 comments on commit 86d0a04

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