mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
fixture generator for new table and field level parameters
This commit is contained in:
parent
a445a12020
commit
86d0a04c8d
1 changed files with 10 additions and 2 deletions
|
@ -260,16 +260,24 @@ class FixtureTask extends Shell {
|
||||||
$out = "array(\n";
|
$out = "array(\n";
|
||||||
foreach ($tableInfo as $field => $fieldInfo) {
|
foreach ($tableInfo as $field => $fieldInfo) {
|
||||||
if (is_array($fieldInfo)) {
|
if (is_array($fieldInfo)) {
|
||||||
if ($field != 'indexes') {
|
if (!in_array($field, array('indexes', 'tableParameters'))) {
|
||||||
$col = "\t\t'{$field}' => array('type'=>'" . $fieldInfo['type'] . "', ";
|
$col = "\t\t'{$field}' => array('type'=>'" . $fieldInfo['type'] . "', ";
|
||||||
$col .= join(', ', $this->_Schema->__values($fieldInfo));
|
$col .= join(', ', $this->_Schema->__values($fieldInfo));
|
||||||
} else {
|
} elseif ($field == 'indexes') {
|
||||||
$col = "\t\t'indexes' => array(";
|
$col = "\t\t'indexes' => array(";
|
||||||
$props = array();
|
$props = array();
|
||||||
foreach ((array)$fieldInfo as $key => $index) {
|
foreach ((array)$fieldInfo as $key => $index) {
|
||||||
$props[] = "'{$key}' => array(".join(', ', $this->_Schema->__values($index)).")";
|
$props[] = "'{$key}' => array(".join(', ', $this->_Schema->__values($index)).")";
|
||||||
}
|
}
|
||||||
$col .= join(', ', $props);
|
$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 .= ")";
|
$col .= ")";
|
||||||
$cols[] = $col;
|
$cols[] = $col;
|
||||||
|
|
Loading…
Reference in a new issue