integrate namespace into schema.xml skeleton
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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
|
||||
-->
|
||||
|
||||
Reference in New Issue
Block a user