Commit c26ed844 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 3a6ce5a6
......@@ -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);
}
......
......@@ -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']);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment