|
@@ 161-170 (lines=10) @@
|
| 158 |
|
* @param string $controllerType |
| 159 |
|
* @return boolean |
| 160 |
|
*/ |
| 161 |
|
private function generateControllerTemplate($module, $mod_path, $force = false, $controllerType = "") |
| 162 |
|
{ |
| 163 |
|
//Generamos el controlador base |
| 164 |
|
$this->log->infoLog("Generamos el controlador BASE"); |
| 165 |
|
$controller = $this->tpl->dump("generator/controller.template.twig", array( |
| 166 |
|
"module" => $module, |
| 167 |
|
"controllerType" => $controllerType, |
| 168 |
|
)); |
| 169 |
|
return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Controller" . DIRECTORY_SEPARATOR . "{$module}Controller.php", $force); |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
/** |
| 173 |
|
* @param string $module |
|
@@ 231-239 (lines=9) @@
|
| 228 |
|
* @param boolean $force |
| 229 |
|
* @return boolean |
| 230 |
|
*/ |
| 231 |
|
private function generateServiceTemplate($module, $mod_path, $force = false) |
| 232 |
|
{ |
| 233 |
|
//Generamos el controlador base |
| 234 |
|
$this->log->infoLog("Generamos el servicio BASE"); |
| 235 |
|
$controller = $this->tpl->dump("generator/service.template.twig", array( |
| 236 |
|
"module" => $module, |
| 237 |
|
)); |
| 238 |
|
return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$module}Service.php", $force); |
| 239 |
|
} |
| 240 |
|
|
| 241 |
|
/** |
| 242 |
|
* @param string $module |
|
@@ 263-272 (lines=10) @@
|
| 260 |
|
* @param boolean $force |
| 261 |
|
* @return boolean |
| 262 |
|
*/ |
| 263 |
|
private function generateSchemaTemplate($module, $mod_path, $force = false) |
| 264 |
|
{ |
| 265 |
|
//Generamos el autoloader del módulo |
| 266 |
|
$this->log->infoLog("Generamos el schema"); |
| 267 |
|
$schema = $this->tpl->dump("generator/schema.propel.twig", array( |
| 268 |
|
"module" => $module, |
| 269 |
|
"db" => $this->config->get("db_name"), |
| 270 |
|
)); |
| 271 |
|
return $this->writeTemplateToFile($schema, $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", $force); |
| 272 |
|
} |
| 273 |
|
|
| 274 |
|
/** |
| 275 |
|
* @param string $module |
|
@@ 300-308 (lines=9) @@
|
| 297 |
|
* @param boolean $force |
| 298 |
|
* @return boolean |
| 299 |
|
*/ |
| 300 |
|
private function generateIndexTemplate($module, $mod_path, $force = false) |
| 301 |
|
{ |
| 302 |
|
//Generamos la plantilla de index |
| 303 |
|
$this->log->infoLog("Generamos una plantilla base por defecto"); |
| 304 |
|
$index = $this->tpl->dump("generator/index.template.twig", array( |
| 305 |
|
"module" => $module, |
| 306 |
|
)); |
| 307 |
|
return $this->writeTemplateToFile($index, $mod_path . $module . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", $force); |
| 308 |
|
} |
| 309 |
|
|
| 310 |
|
/** |
| 311 |
|
* Método que graba el contenido de una plantilla en un fichero |
|
@@ 359-367 (lines=9) @@
|
| 356 |
|
* |
| 357 |
|
* @return bool |
| 358 |
|
*/ |
| 359 |
|
private function createApi($module, $mod_path, $force, $api) |
| 360 |
|
{ |
| 361 |
|
$controller = $this->tpl->dump("generator/api.template.twig", array( |
| 362 |
|
"module" => $module, |
| 363 |
|
"api" => $api |
| 364 |
|
)); |
| 365 |
|
|
| 366 |
|
return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Api" . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
| 367 |
|
} |
| 368 |
|
|
| 369 |
|
/** |
| 370 |
|
* Method that copy resources recursively |