Fixes to indexes and to not call parent::setUp() in the base classes.
This commit is contained in:
parent
34af8e3aa1
commit
38331335ab
@ -268,6 +268,7 @@ END;
|
||||
return "\n\tpublic function setTableDefinition()"."\n\t{\n".implode("\n", $ret)."\n\t}";
|
||||
}
|
||||
}
|
||||
|
||||
public function buildSetUp(array $options, array $columns, array $relations)
|
||||
{
|
||||
$ret = array();
|
||||
@ -413,6 +414,7 @@ END;
|
||||
$options['className'] = 'Base' . $options['className'];
|
||||
$options['abstract'] = true;
|
||||
$options['fileName'] = $generatedPath . DIRECTORY_SEPARATOR . $options['className'] . $this->suffix;
|
||||
$options['override_parent'] = true;
|
||||
|
||||
$this->writeDefinition($options, $columns, $relations, $indexes);
|
||||
} else {
|
||||
@ -422,24 +424,25 @@ END;
|
||||
|
||||
public function writeDefinition(array $options, array $columns, array $relations = array(), array $indexes = array())
|
||||
{
|
||||
$content = $this->buildDefinition($options, $columns, $relations, $indexes);
|
||||
$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);
|
||||
$content = $this->buildDefinition($options, $columns, $relations, $indexes);
|
||||
$code = "<?php\n";
|
||||
|
||||
if ($bytes === false) {
|
||||
throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $options['fileName']);
|
||||
}
|
||||
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) {
|
||||
throw new Doctrine_Import_Builder_Exception("Couldn't write file " . $options['fileName']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,8 +119,9 @@ class Doctrine_Import_Schema
|
||||
$options = $this->getOptions($properties, $directory);
|
||||
$columns = $this->getColumns($properties);
|
||||
$relations = $this->getRelations($properties);
|
||||
$indexes = $this->getIndexes($properties);
|
||||
|
||||
$builder->buildRecord($options, $columns, $relations);
|
||||
$builder->buildRecord($options, $columns, $relations, $indexes);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user