Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 function _fromDb($model)
 {
     $this->{$model}->recursive = -1;
     return Yaml::Dump(Set::extract($this->{$model}->find('all'), '{n}.' . $model));
 }