function _buildYaml($tables) { if (!is_array($tables)) { $tables = array($tables); } foreach ($tables as $table) { $dbShema['UP']['create_table'][$table] = $this->__buildUpSchema($table); $dbShema['DOWN']['drop_table'][] = $table; } if (count($dbShema['DOWN']['drop_table']) == 1) { $dbShema['DOWN']['drop_table'] = $dbShema['DOWN']['drop_table'][0]; } // print file header $out = '#' . "\n"; $out .= '# migration YAML file' . "\n"; $out .= '#' . "\n"; return Yaml::Dump($dbShema); }
function _fromDb($model) { $this->{$model}->recursive = -1; return Yaml::Dump(Set::extract($this->{$model}->find('all'), '{n}.' . $model)); }