1
0
mirror of synced 2025-02-21 14:43:14 +03:00

[2.0] Fixed issue with file-based metadata drivers and the CLI.

This commit is contained in:
romanb 2009-09-02 16:08:03 +00:00
parent 4fa4d7a8ca
commit bf1a52517d
2 changed files with 8 additions and 6 deletions

View File

@ -180,15 +180,15 @@ abstract class AbstractFileDriver implements Driver
* *
* @return array The list of class names that have been preloaded. * @return array The list of class names that have been preloaded.
*/ */
public function preload() public function preload($force = false)
{ {
if ($this->_mode != self::PRELOAD) { if ($this->_mode != self::PRELOAD && ! $force) {
return array(); return array();
} }
foreach ((array)$this->_paths as $path) { foreach ((array)$this->_paths as $path) {
if (is_dir($path)) { if (is_dir($path)) {
$files = glob($path . '/*' . $this->_fileExtension); $files = glob($path . '/*');
foreach ($files as $file) { foreach ($files as $file) {
$this->_elements = array_merge($this->_elements, $this->_loadMappingFile($file)); $this->_elements = array_merge($this->_elements, $this->_loadMappingFile($file));
} }

View File

@ -52,7 +52,7 @@ class SchemaToolTask extends AbstractTask
{ {
$this->getPrinter()->write('schema-tool', 'KEYWORD'); $this->getPrinter()->write('schema-tool', 'KEYWORD');
$this->getPrinter()->writeln( $this->getPrinter()->writeln(
' --create | --drop | --update [--dump-sql] [--classdir=<path>]', ' (--create | --drop | --update) [--dump-sql] [--classdir=<path>]',
'INFO'); 'INFO');
} }
@ -126,8 +126,10 @@ class SchemaToolTask extends AbstractTask
} }
} }
} else { } else {
$driver->preload(); $preloadedClasses = $driver->preload(true);
$classes = $cmf->getLoadedMetadata(); foreach ($preloadedClasses as $className) {
$classes[] = $cmf->getMetadataFor($className);
}
} }
$printer = $this->getPrinter(); $printer = $this->getPrinter();