1
0
mirror of synced 2024-12-14 07:06:04 +03:00
This commit is contained in:
zYne 2007-07-23 20:28:46 +00:00
parent 3a6ce5a6c6
commit c26ed8441b
2 changed files with 11 additions and 6 deletions

View File

@ -192,7 +192,8 @@ class Doctrine_Import extends Doctrine_Connection_Module
foreach ($this->listTables() as $table) {
$builder->buildRecord(array('tableName' => $table,
'className' => Doctrine::classify($table)),
$this->listTableColumns($table));
$this->listTableColumns($table),
array());
$classes[] = Doctrine::classify($table);
}

View File

@ -224,9 +224,13 @@ END;
return $content;
}
public function buildRecord($table, $columns, $relations)
public function buildRecord($options, $columns, $relations)
{
if (empty($fileName)) {
if ( ! isset($options['className'])) {
throw new Doctrine_Import_Builder_Exception('Missing class name.');
}
if ( ! isset($options['fileName'])) {
if (empty($this->path)) {
$errMsg = 'No build target directory set.';
throw new Doctrine_Import_Builder_Exception($errMsg);
@ -238,15 +242,15 @@ END;
throw new Doctrine_Import_Builder_Exception($errMsg);
}
$fileName = $this->path . DIRECTORY_SEPARATOR . $className . $this->suffix;
$options['fileName'] = $this->path . DIRECTORY_SEPARATOR . $options['className'] . $this->suffix;
}
$content = $this->buildDefinition($options, $columns, $relations);
$bytes = file_put_contents($fileName, '<?php' . PHP_EOL . $content);
$bytes = file_put_contents($options['fileName'], '<?php' . PHP_EOL . $content);
if ($bytes === false) {
throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $fileName);
throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $options['fileName']);
}
}
}