Implemented generation for loadTemplate() from Schema file.
This commit is contained in:
parent
e63393cd39
commit
3e39fcf30c
@ -210,6 +210,26 @@ END;
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (isset($options['templates']) && !empty($options['templates'])) {
|
||||
$ret[$i] = PHP_EOL .str_repeat(' ', 8) . '// Load Class Template(s)';
|
||||
$i++;
|
||||
|
||||
if (!is_array($options['templates'])) {
|
||||
// explode to extract each template separated by commas
|
||||
$templatesArray = explode(',', $options['templates']);
|
||||
} else {
|
||||
// set the existing array to templatesArray to be traversed through
|
||||
$templatesArray = $options['templates'];
|
||||
}
|
||||
|
||||
foreach ($templatesArray as $templateName) {
|
||||
$ret[$i] = str_repeat(' ', 8) . '$this->loadTemplate(\''. trim($templateName) .'\');';
|
||||
$i++;
|
||||
}
|
||||
$ret[$i] = '';
|
||||
$i++;
|
||||
}
|
||||
|
||||
foreach ($columns as $name => $column) {
|
||||
$ret[$i] = ' $this->hasColumn(\'' . $name . '\', \'' . $column['type'] . '\'';
|
||||
|
||||
|
@ -139,6 +139,7 @@ class Doctrine_Import_Schema
|
||||
$options['className'] = $properties['className'];
|
||||
$options['fileName'] = $directory.DIRECTORY_SEPARATOR.$properties['className'].'.class.php';
|
||||
$options['tableName'] = isset($properties['tableName']) ? $properties['tableName']:null;
|
||||
$options['templates'] = isset($properties['templates']) ? $properties['templates']:null;
|
||||
|
||||
if (isset($properties['inheritance'])) {
|
||||
$options['inheritance'] = $properties['inheritance'];
|
||||
@ -239,6 +240,7 @@ class Doctrine_Import_Schema
|
||||
|
||||
$build[$className]['tableName'] = $tableName;
|
||||
$build[$className]['columns'] = $columns;
|
||||
$build[$className]['templates'] = isset($table['templates']) ? $table['templates']:array();
|
||||
$build[$className]['relations'] = isset($table['relations']) ? $table['relations']:array();
|
||||
$build[$className]['indexes'] = isset($table['indexes']) ? $table['indexes']:array();
|
||||
$build[$className]['attributes'] = isset($table['attributes']) ? $table['attributes']:array();
|
||||
|
Loading…
Reference in New Issue
Block a user