Commit 38331335 authored by Jonathan.Wage's avatar Jonathan.Wage

Fixes to indexes and to not call parent::setUp() in the base classes.

parent 34af8e3a
...@@ -268,6 +268,7 @@ END; ...@@ -268,6 +268,7 @@ END;
return "\n\tpublic function setTableDefinition()"."\n\t{\n".implode("\n", $ret)."\n\t}"; return "\n\tpublic function setTableDefinition()"."\n\t{\n".implode("\n", $ret)."\n\t}";
} }
} }
public function buildSetUp(array $options, array $columns, array $relations) public function buildSetUp(array $options, array $columns, array $relations)
{ {
$ret = array(); $ret = array();
...@@ -413,6 +414,7 @@ END; ...@@ -413,6 +414,7 @@ END;
$options['className'] = 'Base' . $options['className']; $options['className'] = 'Base' . $options['className'];
$options['abstract'] = true; $options['abstract'] = true;
$options['fileName'] = $generatedPath . DIRECTORY_SEPARATOR . $options['className'] . $this->suffix; $options['fileName'] = $generatedPath . DIRECTORY_SEPARATOR . $options['className'] . $this->suffix;
$options['override_parent'] = true;
$this->writeDefinition($options, $columns, $relations, $indexes); $this->writeDefinition($options, $columns, $relations, $indexes);
} else { } else {
...@@ -422,24 +424,25 @@ END; ...@@ -422,24 +424,25 @@ END;
public function writeDefinition(array $options, array $columns, array $relations = array(), array $indexes = array()) public function writeDefinition(array $options, array $columns, array $relations = array(), array $indexes = array())
{ {
$content = $this->buildDefinition($options, $columns, $relations, $indexes); $content = $this->buildDefinition($options, $columns, $relations, $indexes);
$code = "<?php\n"; $code = "<?php\n";
if (isset($options['requires'])) {
if (!is_array($options['requires'])) {
$options['requires'] = array($options['requires']);
}
foreach ($options['requires'] as $require) {
$code .= "require_once('".$require."');";
}
}
$code .= PHP_EOL . $content;
$bytes = file_put_contents($options['fileName'], $code);
if ($bytes === false) { if (isset($options['requires'])) {
throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $options['fileName']); if (!is_array($options['requires'])) {
} $options['requires'] = array($options['requires']);
}
foreach ($options['requires'] as $require) {
$code .= "require_once('".$require."');";
}
}
$code .= PHP_EOL . $content;
$bytes = file_put_contents($options['fileName'], $code);
if ($bytes === false) {
throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $options['fileName']);
}
} }
} }
...@@ -119,8 +119,9 @@ class Doctrine_Import_Schema ...@@ -119,8 +119,9 @@ class Doctrine_Import_Schema
$options = $this->getOptions($properties, $directory); $options = $this->getOptions($properties, $directory);
$columns = $this->getColumns($properties); $columns = $this->getColumns($properties);
$relations = $this->getRelations($properties); $relations = $this->getRelations($properties);
$indexes = $this->getIndexes($properties);
$builder->buildRecord($options, $columns, $relations); $builder->buildRecord($options, $columns, $relations, $indexes);
} }
} }
......
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