diff --git a/core/lib/Thelia/Command/ModuleGenerateCommand.php b/core/lib/Thelia/Command/ModuleGenerateCommand.php index 8329b84e1..0f456ea63 100644 --- a/core/lib/Thelia/Command/ModuleGenerateCommand.php +++ b/core/lib/Thelia/Command/ModuleGenerateCommand.php @@ -94,6 +94,7 @@ class ModuleGenerateCommand extends BaseModuleGenerate { $schemaContent = file_get_contents($skeletonDir . "schema.xml"); $schemaContent = str_replace("%%CONFIG_DIR%%", THELIA_CONF_DIR, $schemaContent); + $schemaContent = str_replace("%%NAMESPACE%%", $this->module, $schemaContent); file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent); } diff --git a/core/lib/Thelia/Command/ModuleGenerateModelCommand.php b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php index 0b278973e..27904400a 100644 --- a/core/lib/Thelia/Command/ModuleGenerateModelCommand.php +++ b/core/lib/Thelia/Command/ModuleGenerateModelCommand.php @@ -72,6 +72,7 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate { $this->generateModel(); + if ($input->getOption("generate-sql")) { $this->generateSql(); } @@ -79,12 +80,12 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate { protected function generateSql() { - $sqlBuild = new ModuleGenerateSqlCommand(); - $sqlBuild->setApplication($this->getApplication()); - $sqlBuild->run( + $command = $this->getApplication()->find("module:generate:sql"); + + $command->run( new ArrayInput(array( - "command" => $sqlBuild->getName(), + "command" => $command->getName(), "name" => $this->module )), new StreamOutput(fopen('php://memory', 'w', false)) @@ -106,9 +107,18 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate { new StreamOutput(fopen('php://memory', 'w', false)) ); - if ($fs->exists(THELIA_MODULE_DIR . DS . "Thelia")) { - $fs->remove(THELIA_MODULE_DIR . DS . "Thelia"); + $verifyDirectories = array( + THELIA_MODULE_DIR . DS . "Thelia", + $this->moduleDirectory . DS . "Model" . DS . "Thelia" + ); + + foreach ($verifyDirectories as $directory) { + if ($fs->exists($directory)) { + $fs->remove($directory); + } } + + } } \ No newline at end of file diff --git a/core/lib/Thelia/Command/Skeleton/Module/schema.xml b/core/lib/Thelia/Command/Skeleton/Module/schema.xml index 1ef803d36..3fcba0184 100644 --- a/core/lib/Thelia/Command/Skeleton/Module/schema.xml +++ b/core/lib/Thelia/Command/Skeleton/Module/schema.xml @@ -1,5 +1,5 @@ - +