Exemplo n.º 1
0
 public function testYmlExport()
 {
     $export = new Doctrine_Export_Schema();
     $export->exportSchema('schema-export.yml', 'yml', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'models', $this->tables);
     unlink('schema-export.yml');
 }
Exemplo n.º 2
0
 /**
  * Generate yaml schema file for the models in the specified directory
  *
  * @param string $yamlPath Path to your yaml schema files
  * @param string $directory Directory to generate your models in
  * @return void
  */
 public static function generateYamlFromModels($yamlPath, $directory)
 {
     $export = new Doctrine_Export_Schema();
     return $export->exportSchema($yamlPath, 'yml', $directory);
 }
 protected function generateYaml($schemaPath, $directory = null, $models = array(), $modelLoading = null)
 {
     $currentProjectModels = (array) sfYaml::load($schemaPath);
     $export = new Doctrine_Export_Schema();
     $newProjectModels = $export->buildSchema($directory, $models, $modelLoading);
     $projectModels = array_merge($currentProjectModels, $newProjectModels);
     if (is_dir($schemaPath)) {
         $schemaPath = $schemaPath . DIRECTORY_SEPARATOR . 'schema.yml';
     }
     return Doctrine_Parser::dump($projectModels, 'yml', $schemaPath);
 }