@@ -5,12 +5,9 @@ |
||
| 5 | 5 | use Propel\Runtime\ActiveQuery\ModelCriteria; |
| 6 | 6 | use Propel\Runtime\ActiveRecord\ActiveRecordInterface; |
| 7 | 7 | use Propel\Runtime\Connection\ConnectionInterface; |
| 8 | - use Propel\Runtime\Map\ColumnMap; |
|
| 9 | 8 | use Propel\Runtime\Map\TableMap; |
| 10 | 9 | use Propel\Runtime\Propel; |
| 11 | 10 | use PSFS\base\config\Config; |
| 12 | - use PSFS\base\dto\Field; |
|
| 13 | - use PSFS\base\dto\Form; |
|
| 14 | 11 | use PSFS\base\dto\JsonResponse; |
| 15 | 12 | use PSFS\base\dto\Order; |
| 16 | 13 | use PSFS\base\Logger; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * |
| 180 | 180 | * @param ModelCriteria $query |
| 181 | 181 | */ |
| 182 | - private function addOrders(ModelCriteria &$query) |
|
| 182 | + private function addOrders(ModelCriteria & $query) |
|
| 183 | 183 | { |
| 184 | 184 | $orderAdded = FALSE; |
| 185 | 185 | foreach ($this->order->getOrders() as $field => $direction) { |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $orderAdded = TRUE; |
| 188 | 188 | if ($direction === Order::ASC) { |
| 189 | 189 | $query->addAscendingOrderByColumn($field); |
| 190 | - } else { |
|
| 190 | + }else { |
|
| 191 | 191 | $query->addDescendingOrderByColumn($field); |
| 192 | 192 | } |
| 193 | 193 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * |
| 203 | 203 | * @param ModelCriteria $query |
| 204 | 204 | */ |
| 205 | - private function addExtraColumns(ModelCriteria &$query) |
|
| 205 | + private function addExtraColumns(ModelCriteria & $query) |
|
| 206 | 206 | { |
| 207 | 207 | if (!empty($this->extraColumns)) { |
| 208 | 208 | foreach ($this->extraColumns as $expression => $columnName) { |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * |
| 217 | 217 | * @param ModelCriteria $query |
| 218 | 218 | */ |
| 219 | - protected function joinTables(ModelCriteria &$query) |
|
| 219 | + protected function joinTables(ModelCriteria & $query) |
|
| 220 | 220 | { |
| 221 | 221 | //TODO for specific implementations |
| 222 | 222 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @param ModelCriteria $query |
| 228 | 228 | */ |
| 229 | - private function addFilters(ModelCriteria &$query) |
|
| 229 | + private function addFilters(ModelCriteria & $query) |
|
| 230 | 230 | { |
| 231 | 231 | if (count($this->query) > 0) { |
| 232 | 232 | foreach ($this->query as $field => $value) { |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $text = preg_replace('/(\'|\")/', '', $value); |
| 245 | 245 | $text = preg_replace('/\ /', '%', $text); |
| 246 | 246 | $query->filterBy($tableField, '%'.$text.'%', Criteria::LIKE); |
| 247 | - } else { |
|
| 247 | + }else { |
|
| 248 | 248 | $query->filterBy($tableField, $value, Criteria::EQUAL); |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -267,10 +267,10 @@ discard block |
||
| 267 | 267 | list($page, $limit) = $this->extractPagination(); |
| 268 | 268 | if ($limit == -1) { |
| 269 | 269 | $this->list = $query->find($this->con); |
| 270 | - } else { |
|
| 270 | + }else { |
|
| 271 | 271 | $this->list = $query->paginate($page, $limit, $this->con); |
| 272 | 272 | } |
| 273 | - } catch (\Exception $e) { |
|
| 273 | + }catch (\Exception $e) { |
|
| 274 | 274 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $this->joinTables($query); |
| 288 | 288 | $this->addExtraColumns($query); |
| 289 | 289 | $this->model = $query->findPk($pk); |
| 290 | - } catch (\Exception $e) { |
|
| 290 | + }catch (\Exception $e) { |
|
| 291 | 291 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 292 | 292 | } |
| 293 | 293 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | $saved = TRUE; |
| 376 | 376 | $model = $this->model->toArray(); |
| 377 | 377 | } |
| 378 | - } catch (\Exception $e) { |
|
| 378 | + }catch (\Exception $e) { |
|
| 379 | 379 | jpre($e->getMessage(), TRUE); |
| 380 | 380 | Logger::getInstance()->errorLog($e->getMessage()); |
| 381 | 381 | } |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | $this->model->delete($this->con); |
| 405 | 405 | $deleted = TRUE; |
| 406 | 406 | } |
| 407 | - } catch (\Exception $e) { |
|
| 407 | + }catch (\Exception $e) { |
|
| 408 | 408 | Logger::getInstance(get_class($this->model))->errorLog($e->getMessage()); |
| 409 | 409 | } |
| 410 | 410 | } |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | private function extractQuery() |
| 450 | 450 | { |
| 451 | - $queryReflector = new \ReflectionClass($this->getModelNamespace() . "Query"); |
|
| 451 | + $queryReflector = new \ReflectionClass($this->getModelNamespace()."Query"); |
|
| 452 | 452 | /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */ |
| 453 | 453 | $query = $queryReflector->getMethod('create')->invoke(NULL); |
| 454 | 454 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | if ($this->con->inTransaction()) { |
| 493 | 493 | if ($status === 200) { |
| 494 | 494 | $this->con->commit(); |
| 495 | - } else { |
|
| 495 | + }else { |
|
| 496 | 496 | $this->con->rollBack(); |
| 497 | 497 | } |
| 498 | 498 | } |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | return $this->render('api.admin.html.twig', array( |
| 537 | 537 | "api" => $this->getApi(), |
| 538 | 538 | "domain" => $this->domain, |
| 539 | - "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('api-' . $this->getApi() . "-pk"), TRUE)), |
|
| 539 | + "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('api-'.$this->getApi()."-pk"), TRUE)), |
|
| 540 | 540 | )); |
| 541 | 541 | } |
| 542 | 542 | |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | $return = $this->list->toArray(); |
| 574 | 574 | $total = $this->list->getNbResults(); |
| 575 | 575 | $pages = $this->list->getLastPage(); |
| 576 | - } catch (\Exception $e) { |
|
| 576 | + }catch (\Exception $e) { |
|
| 577 | 577 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 578 | 578 | } |
| 579 | 579 | |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | $return = array(); |
| 593 | 593 | if (NULL === $model && method_exists($model, 'toArray')) { |
| 594 | 594 | $code = 404; |
| 595 | - } else { |
|
| 595 | + }else { |
|
| 596 | 596 | $return = $model->toArray(); |
| 597 | 597 | } |
| 598 | 598 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $fDto = self::generateNumericField($field); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if(null !== $fDto) { |
|
| 37 | + if (null !== $fDto) { |
|
| 38 | 38 | $form->addField($fDto); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $fDto->required = $mappedColumn->isNotNull(); |
| 55 | 55 | $relatedModel = strtolower($mappedColumn->getRelation()->getForeignTable()->getPhpName()); |
| 56 | 56 | $fDto->entity = $relatedModel; |
| 57 | - $fDto->url = Router::getInstance()->getRoute('api-' . $relatedModel . '-pk'); |
|
| 57 | + $fDto->url = Router::getInstance()->getRoute('api-'.$relatedModel.'-pk'); |
|
| 58 | 58 | return $fDto; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -32,24 +32,24 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public static function findTranslations($path, $locale) |
| 34 | 34 | { |
| 35 | - $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 36 | - $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR; |
|
| 35 | + $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 36 | + $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR; |
|
| 37 | 37 | |
| 38 | 38 | $translations = array(); |
| 39 | 39 | if (file_exists($path)) { |
| 40 | 40 | $d = dir($path); |
| 41 | 41 | while (false !== ($dir = $d->read())) { |
| 42 | 42 | Config::createDir($locale_path); |
| 43 | - if (!file_exists($locale_path . 'translations.po')) { |
|
| 44 | - file_put_contents($locale_path . 'translations.po', ''); |
|
| 43 | + if (!file_exists($locale_path.'translations.po')) { |
|
| 44 | + file_put_contents($locale_path.'translations.po', ''); |
|
| 45 | 45 | } |
| 46 | - $inspect_path = realpath($path . DIRECTORY_SEPARATOR . $dir); |
|
| 47 | - $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext " . |
|
| 48 | - $inspect_path . DIRECTORY_SEPARATOR . |
|
| 46 | + $inspect_path = realpath($path.DIRECTORY_SEPARATOR.$dir); |
|
| 47 | + $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ". |
|
| 48 | + $inspect_path.DIRECTORY_SEPARATOR. |
|
| 49 | 49 | "*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po"; |
| 50 | - if (is_dir($path . DIRECTORY_SEPARATOR . $dir) && preg_match('/^\./', $dir) == 0) { |
|
| 51 | - $res = _('Revisando directorio: ') . $inspect_path; |
|
| 52 | - $res .= _('Comando ejecutado: ') . $cmd_php; |
|
| 50 | + if (is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./', $dir) == 0) { |
|
| 51 | + $res = _('Revisando directorio: ').$inspect_path; |
|
| 52 | + $res .= _('Comando ejecutado: ').$cmd_php; |
|
| 53 | 53 | $res .= shell_exec($cmd_php); |
| 54 | 54 | usleep(10); |
| 55 | 55 | $translations[] = $res; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function createStructureModule($module, $force = false, $type = "", $isModule = false) |
| 72 | 72 | { |
| 73 | - $mod_path = CORE_DIR . DIRECTORY_SEPARATOR; |
|
| 73 | + $mod_path = CORE_DIR.DIRECTORY_SEPARATOR; |
|
| 74 | 74 | $module = ucfirst($module); |
| 75 | 75 | $this->createModulePath($module, $mod_path, $isModule); |
| 76 | 76 | $this->createModulePathTree($module, $mod_path, $isModule); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | Config::createDir($mod_path); |
| 94 | 94 | // Create module path |
| 95 | 95 | if (false === $isModule) { |
| 96 | - Config::createDir($mod_path . $module); |
|
| 96 | + Config::createDir($mod_path.$module); |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
@@ -110,20 +110,20 @@ discard block |
||
| 110 | 110 | $paths = [ |
| 111 | 111 | "Api", "Api/base", "Config", "Controller", "Form", "Models", "Public", "Templates", "Services", "Test" |
| 112 | 112 | ]; |
| 113 | - $module_path = $isModule ? $mod_path : $mod_path . $module; |
|
| 113 | + $module_path = $isModule ? $mod_path : $mod_path.$module; |
|
| 114 | 114 | foreach ($paths as $path) { |
| 115 | - Config::createDir($module_path . DIRECTORY_SEPARATOR . $path); |
|
| 115 | + Config::createDir($module_path.DIRECTORY_SEPARATOR.$path); |
|
| 116 | 116 | } |
| 117 | 117 | //Creamos las carpetas de los assets |
| 118 | 118 | $htmlPaths = array("css", "js", "img", "media", "font"); |
| 119 | 119 | foreach ($htmlPaths as $path) { |
| 120 | - Config::createDir($module_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path); |
|
| 120 | + Config::createDir($module_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | if ($isModule) { |
| 124 | 124 | return $this->writeTemplateToFile(json_encode([ |
| 125 | - "module" => "\\" . preg_replace('/(\\\|\/)/', '\\\\', $module), |
|
| 126 | - ], JSON_PRETTY_PRINT), $mod_path . DIRECTORY_SEPARATOR . "module.json", true); |
|
| 125 | + "module" => "\\".preg_replace('/(\\\|\/)/', '\\\\', $module), |
|
| 126 | + ], JSON_PRETTY_PRINT), $mod_path.DIRECTORY_SEPARATOR."module.json", true); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | private function createModuleBaseFiles($module, $mod_path, $force = false, $controllerType = '', $isModule = false) |
| 139 | 139 | { |
| 140 | - $module_path = $isModule ? $mod_path : $mod_path . $module; |
|
| 140 | + $module_path = $isModule ? $mod_path : $mod_path.$module; |
|
| 141 | 141 | $this->generateControllerTemplate($module, $module_path, $force, $controllerType); |
| 142 | 142 | $this->generateServiceTemplate($module, $module_path, $force); |
| 143 | 143 | $this->genereateAutoloaderTemplate($module, $module_path, $force, $isModule); |
@@ -156,24 +156,24 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | private function createModuleModels($module, $path, $isModule = false) |
| 158 | 158 | { |
| 159 | - $module_path = $isModule ? $path : $path . $module; |
|
| 160 | - $module_path = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $module_path); |
|
| 159 | + $module_path = $isModule ? $path : $path.$module; |
|
| 160 | + $module_path = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $module_path); |
|
| 161 | 161 | //Generamos las clases de propel y la configuración |
| 162 | - $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR . |
|
| 163 | - "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel "; |
|
| 164 | - $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . |
|
| 165 | - DIRECTORY_SEPARATOR . "Config"; |
|
| 166 | - $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module_path . DIRECTORY_SEPARATOR . |
|
| 167 | - "Config --output-dir=" . CORE_DIR . " --verbose"; |
|
| 168 | - $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n" . $exec . "build" . $opt . $schemaOpt); |
|
| 169 | - $ret = shell_exec($exec . "build" . $opt . $schemaOpt); |
|
| 162 | + $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR. |
|
| 163 | + "vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel "; |
|
| 164 | + $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path. |
|
| 165 | + DIRECTORY_SEPARATOR."Config"; |
|
| 166 | + $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module_path.DIRECTORY_SEPARATOR. |
|
| 167 | + "Config --output-dir=".CORE_DIR." --verbose"; |
|
| 168 | + $this->log->infoLog("[GENERATOR] Ejecutamos propel:\n".$exec."build".$opt.$schemaOpt); |
|
| 169 | + $ret = shell_exec($exec."build".$opt.$schemaOpt); |
|
| 170 | 170 | |
| 171 | 171 | $this->log->infoLog("[GENERATOR] Generamos clases invocando a propel:\n $ret"); |
| 172 | - $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . |
|
| 173 | - $module_path . DIRECTORY_SEPARATOR . "Config" . $schemaOpt); |
|
| 172 | + $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR. |
|
| 173 | + $module_path.DIRECTORY_SEPARATOR."Config".$schemaOpt); |
|
| 174 | 174 | $this->log->infoLog("[GENERATOR] Generamos sql invocando a propel:\n $ret"); |
| 175 | - $ret = shell_exec($exec . "config:convert" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . |
|
| 176 | - $module_path . DIRECTORY_SEPARATOR . "Config"); |
|
| 175 | + $ret = shell_exec($exec."config:convert".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR. |
|
| 176 | + $module_path.DIRECTORY_SEPARATOR."Config"); |
|
| 177 | 177 | $this->log->infoLog("[GENERATOR] Generamos configuración invocando a propel:\n $ret"); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -194,23 +194,23 @@ discard block |
||
| 194 | 194 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 195 | 195 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 196 | 196 | "class" => $class, |
| 197 | - "controllerType" => $class . "Base", |
|
| 197 | + "controllerType" => $class."Base", |
|
| 198 | 198 | "is_base" => false |
| 199 | 199 | )); |
| 200 | - $controller = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" . |
|
| 201 | - DIRECTORY_SEPARATOR . "{$class}Controller.php", $force); |
|
| 200 | + $controller = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller". |
|
| 201 | + DIRECTORY_SEPARATOR."{$class}Controller.php", $force); |
|
| 202 | 202 | |
| 203 | 203 | $controllerBody = $this->tpl->dump("generator/controller.template.twig", array( |
| 204 | 204 | "module" => $module, |
| 205 | 205 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
| 206 | 206 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
| 207 | - "class" => $class . "Base", |
|
| 207 | + "class" => $class."Base", |
|
| 208 | 208 | "service" => $class, |
| 209 | 209 | "controllerType" => $controllerType, |
| 210 | 210 | "is_base" => true |
| 211 | 211 | )); |
| 212 | - $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path . DIRECTORY_SEPARATOR . "Controller" . |
|
| 213 | - DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true); |
|
| 212 | + $controllerBase = $this->writeTemplateToFile($controllerBody, $mod_path.DIRECTORY_SEPARATOR."Controller". |
|
| 213 | + DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true); |
|
| 214 | 214 | return ($controller && $controllerBase); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -225,11 +225,9 @@ discard block |
||
| 225 | 225 | { |
| 226 | 226 | $created = true; |
| 227 | 227 | $modelPath = $isModule ? |
| 228 | - $mod_path . DIRECTORY_SEPARATOR . 'Models' : |
|
| 229 | - $mod_path . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
| 228 | + $mod_path.DIRECTORY_SEPARATOR.'Models' : $mod_path.$module.DIRECTORY_SEPARATOR.'Models'; |
|
| 230 | 229 | $api_path = $isModule ? |
| 231 | - $mod_path . DIRECTORY_SEPARATOR . 'Api' : |
|
| 232 | - $mod_path . $module . DIRECTORY_SEPARATOR . 'Api'; |
|
| 230 | + $mod_path.DIRECTORY_SEPARATOR.'Api' : $mod_path.$module.DIRECTORY_SEPARATOR.'Api'; |
|
| 233 | 231 | if (file_exists($modelPath)) { |
| 234 | 232 | $dir = dir($modelPath); |
| 235 | 233 | while ($file = $dir->read()) { |
@@ -257,7 +255,7 @@ discard block |
||
| 257 | 255 | //Generamos el fichero de configuración |
| 258 | 256 | $this->log->infoLog("Generamos fichero vacío de configuración"); |
| 259 | 257 | return $this->writeTemplateToFile("<?php\n\t", |
| 260 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", |
|
| 258 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", |
|
| 261 | 259 | $force); |
| 262 | 260 | } |
| 263 | 261 | |
@@ -272,10 +270,10 @@ discard block |
||
| 272 | 270 | //Generamos el fichero de configuración |
| 273 | 271 | $this->log->infoLog("Generamos ficheros para assets base"); |
| 274 | 272 | $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", |
| 275 | - $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css", |
|
| 273 | + $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css", |
|
| 276 | 274 | $force); |
| 277 | 275 | $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", |
| 278 | - $mod_path . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js", |
|
| 276 | + $mod_path.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js", |
|
| 279 | 277 | $force); |
| 280 | 278 | return ($css && $js); |
| 281 | 279 | } |
@@ -297,7 +295,7 @@ discard block |
||
| 297 | 295 | "class" => $class, |
| 298 | 296 | )); |
| 299 | 297 | return $this->writeTemplateToFile($controller, |
| 300 | - $mod_path . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$class}Service.php", |
|
| 298 | + $mod_path.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$class}Service.php", |
|
| 301 | 299 | $force); |
| 302 | 300 | } |
| 303 | 301 | |
@@ -318,7 +316,7 @@ discard block |
||
| 318 | 316 | "regex" => preg_replace('/(\\\|\/)/m', '\\\\\\\\\\\\', $module), |
| 319 | 317 | "is_module" => $isModule, |
| 320 | 318 | )); |
| 321 | - return $this->writeTemplateToFile($autoloader, $mod_path . DIRECTORY_SEPARATOR . "autoload.php", $force); |
|
| 319 | + return $this->writeTemplateToFile($autoloader, $mod_path.DIRECTORY_SEPARATOR."autoload.php", $force); |
|
| 322 | 320 | } |
| 323 | 321 | |
| 324 | 322 | /** |
@@ -338,7 +336,7 @@ discard block |
||
| 338 | 336 | "db" => $this->config->get("db_name"), |
| 339 | 337 | )); |
| 340 | 338 | return $this->writeTemplateToFile($schema, |
| 341 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", |
|
| 339 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", |
|
| 342 | 340 | $force); |
| 343 | 341 | } |
| 344 | 342 | |
@@ -361,7 +359,7 @@ discard block |
||
| 361 | 359 | "namespace" => preg_replace('/(\\\|\/)/', '', $module), |
| 362 | 360 | )); |
| 363 | 361 | return $this->writeTemplateToFile($build_properties, |
| 364 | - $mod_path . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml", |
|
| 362 | + $mod_path.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml", |
|
| 365 | 363 | $force); |
| 366 | 364 | } |
| 367 | 365 | |
@@ -379,7 +377,7 @@ discard block |
||
| 379 | 377 | "module" => $module, |
| 380 | 378 | )); |
| 381 | 379 | return $this->writeTemplateToFile($index, |
| 382 | - $mod_path . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", |
|
| 380 | + $mod_path.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", |
|
| 383 | 381 | $force); |
| 384 | 382 | } |
| 385 | 383 | |
@@ -397,11 +395,11 @@ discard block |
||
| 397 | 395 | try { |
| 398 | 396 | $this->cache->storeData($filename, $fileContent, Cache::TEXT, true); |
| 399 | 397 | $created = true; |
| 400 | - } catch (\Exception $e) { |
|
| 398 | + }catch (\Exception $e) { |
|
| 401 | 399 | $this->log->errorLog($e->getMessage()); |
| 402 | 400 | } |
| 403 | - } else { |
|
| 404 | - $this->log->errorLog($filename . _(' not exists or cant write')); |
|
| 401 | + }else { |
|
| 402 | + $this->log->errorLog($filename._(' not exists or cant write')); |
|
| 405 | 403 | } |
| 406 | 404 | return $created; |
| 407 | 405 | } |
@@ -426,7 +424,7 @@ discard block |
||
| 426 | 424 | )); |
| 427 | 425 | |
| 428 | 426 | return $this->writeTemplateToFile($controller, |
| 429 | - $mod_path . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
| 427 | + $mod_path.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
| 430 | 428 | } |
| 431 | 429 | |
| 432 | 430 | /** |
@@ -449,7 +447,7 @@ discard block |
||
| 449 | 447 | "class" => $class, |
| 450 | 448 | )); |
| 451 | 449 | |
| 452 | - return $this->writeTemplateToFile($controller, $mod_path . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
| 450 | + return $this->writeTemplateToFile($controller, $mod_path.DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
| 453 | 451 | } |
| 454 | 452 | |
| 455 | 453 | /** |
@@ -463,12 +461,12 @@ discard block |
||
| 463 | 461 | { |
| 464 | 462 | if (file_exists($filename_path)) { |
| 465 | 463 | $destfolder = basename($filename_path); |
| 466 | - if (!file_exists(WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) || $debug || $force) { |
|
| 464 | + if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
|
| 467 | 465 | if (is_dir($filename_path)) { |
| 468 | - self::copyr($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 469 | - } else { |
|
| 470 | - if (@copy($filename_path, WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder) === FALSE) { |
|
| 471 | - throw new ConfigException("Can't copy " . $filename_path . " to " . WEB_DIR . $dest . DIRECTORY_SEPARATOR . $destfolder); |
|
| 466 | + self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 467 | + }else { |
|
| 468 | + if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
|
| 469 | + throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
|
| 472 | 470 | } |
| 473 | 471 | } |
| 474 | 472 | } |
@@ -487,10 +485,10 @@ discard block |
||
| 487 | 485 | Config::createDir($dst); |
| 488 | 486 | while (false !== ($file = readdir($dir))) { |
| 489 | 487 | if (($file != '.') && ($file != '..')) { |
| 490 | - if (is_dir($src . '/' . $file)) { |
|
| 491 | - self::copyr($src . '/' . $file, $dst . '/' . $file); |
|
| 492 | - } elseif (@copy($src . '/' . $file, $dst . '/' . $file) === false) { |
|
| 493 | - throw new ConfigException("Can't copy " . $src . " to " . $dst); |
|
| 488 | + if (is_dir($src.'/'.$file)) { |
|
| 489 | + self::copyr($src.'/'.$file, $dst.'/'.$file); |
|
| 490 | + } elseif (@copy($src.'/'.$file, $dst.'/'.$file) === false) { |
|
| 491 | + throw new ConfigException("Can't copy ".$src." to ".$dst); |
|
| 494 | 492 | } |
| 495 | 493 | } |
| 496 | 494 | } |