diff --git a/lib/Doctrine/Import.php b/lib/Doctrine/Import.php index 993c43239..57229c342 100644 --- a/lib/Doctrine/Import.php +++ b/lib/Doctrine/Import.php @@ -196,7 +196,7 @@ class Doctrine_Import extends Doctrine_Connection_Module * @param array $databases * @return array the names of the imported classes */ - public function importSchema($directory, array $databases = array()) + public function importSchema($directory, array $databases = array(), array $options = array()) { $connections = Doctrine_Manager::getInstance()->getConnections(); @@ -208,8 +208,8 @@ class Doctrine_Import extends Doctrine_Connection_Module } $builder = new Doctrine_Import_Builder(); - $builder->generateBaseClasses(true); $builder->setTargetPath($directory); + $builder->setOptions($options); $classes = array(); foreach ($connection->import->listTables() as $table) { diff --git a/lib/Doctrine/Import/Builder.php b/lib/Doctrine/Import/Builder.php index 858ebf072..8d02a7314 100644 --- a/lib/Doctrine/Import/Builder.php +++ b/lib/Doctrine/Import/Builder.php @@ -68,7 +68,7 @@ class Doctrine_Import_Builder * * @var string $suffix */ - protected $_suffix = '.class.php'; + protected $_suffix = '.php'; /** * generateBaseClasses @@ -235,6 +235,34 @@ class Doctrine_Import_Builder return $this->_path; } + /** + * setOptions + * + * @param string $options + * @return void + */ + public function setOptions($options) + { + if (!empty($options)) { + foreach ($options as $key => $value) { + $this->setOption($key, $value); + } + } + } + + /** + * setOption + * + * @param string $key + * @param string $value + * @return void + */ + public function setOption($key, $value) + { + $name = '_'.$key; + $this->$name = $value; + } + /** * loadTemplate * diff --git a/lib/Doctrine/Import/Schema.php b/lib/Doctrine/Import/Schema.php index af57c2f9b..2d32863f4 100644 --- a/lib/Doctrine/Import/Schema.php +++ b/lib/Doctrine/Import/Schema.php @@ -46,7 +46,7 @@ class Doctrine_Import_Schema 'generateTableClasses' => true, 'baseClassesDirectory' => 'generated', 'baseClassName' => 'Doctrine_Record', - 'suffix' => '.class.php'); + 'suffix' => '.php'); /** * getOption