integrate namespace into schema.xml skeleton

This commit is contained in:
Manuel Raynaud
2013-07-12 09:46:35 +02:00
parent 8e975a9b62
commit 2941292fdd
3 changed files with 18 additions and 7 deletions

View File

@@ -94,6 +94,7 @@ class ModuleGenerateCommand extends BaseModuleGenerate {
$schemaContent = file_get_contents($skeletonDir . "schema.xml"); $schemaContent = file_get_contents($skeletonDir . "schema.xml");
$schemaContent = str_replace("%%CONFIG_DIR%%", THELIA_CONF_DIR, $schemaContent); $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); file_put_contents($this->moduleDirectory . DIRECTORY_SEPARATOR . "Config". DIRECTORY_SEPARATOR . "schema.xml", $schemaContent);
} }

View File

@@ -72,6 +72,7 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate {
$this->generateModel(); $this->generateModel();
if ($input->getOption("generate-sql")) { if ($input->getOption("generate-sql")) {
$this->generateSql(); $this->generateSql();
} }
@@ -79,12 +80,12 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate {
protected function generateSql() protected function generateSql()
{ {
$sqlBuild = new ModuleGenerateSqlCommand();
$sqlBuild->setApplication($this->getApplication());
$sqlBuild->run( $command = $this->getApplication()->find("module:generate:sql");
$command->run(
new ArrayInput(array( new ArrayInput(array(
"command" => $sqlBuild->getName(), "command" => $command->getName(),
"name" => $this->module "name" => $this->module
)), )),
new StreamOutput(fopen('php://memory', 'w', false)) new StreamOutput(fopen('php://memory', 'w', false))
@@ -106,9 +107,18 @@ class ModuleGenerateModelCommand extends BaseModuleGenerate {
new StreamOutput(fopen('php://memory', 'w', false)) new StreamOutput(fopen('php://memory', 'w', false))
); );
if ($fs->exists(THELIA_MODULE_DIR . DS . "Thelia")) { $verifyDirectories = array(
$fs->remove(THELIA_MODULE_DIR . DS . "Thelia"); THELIA_MODULE_DIR . DS . "Thelia",
$this->moduleDirectory . DS . "Model" . DS . "Thelia"
);
foreach ($verifyDirectories as $directory) {
if ($fs->exists($directory)) {
$fs->remove($directory);
} }
} }
}
} }

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="propel"> <database defaultIdMethod="native" name="thelia" namespace="%%NAMESPACE%%\Model">
<!-- <!--
See propel documentation on http://propelorm.org for all information about schema file See propel documentation on http://propelorm.org for all information about schema file
--> -->