@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | Logger::log('Adding debug headers to render response'); |
77 | 77 | $vars["__DEBUG__"]["includes"] = get_included_files(); |
78 | 78 | $vars["__DEBUG__"]["trace"] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); |
79 | - header('X-PSFS-DEBUG-TS: ' . Dispatcher::getInstance()->getTs() . ' s'); |
|
80 | - header('X-PSFS-DEBUG-MEM: ' . Dispatcher::getInstance()->getMem('MBytes') . ' MBytes'); |
|
81 | - header('X-PSFS-DEBUG-FILES: ' . count(get_included_files()) . ' files opened'); |
|
79 | + header('X-PSFS-DEBUG-TS: '.Dispatcher::getInstance()->getTs().' s'); |
|
80 | + header('X-PSFS-DEBUG-MEM: '.Dispatcher::getInstance()->getMem('MBytes').' MBytes'); |
|
81 | + header('X-PSFS-DEBUG-FILES: '.count(get_included_files()).' files opened'); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | return $vars; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @return int|string |
91 | 91 | * @throws GeneratorException |
92 | 92 | */ |
93 | - public static function httpNotFound(Exception $exception = NULL, bool $isJson = false): int|string |
|
93 | + public static function httpNotFound(Exception $exception = NULL, bool $isJson = false): int | string |
|
94 | 94 | { |
95 | 95 | if (self::isTest()) { |
96 | 96 | return 404; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $notFoundRoute = Config::getParam('route.404'); |
110 | 110 | if (null !== $notFoundRoute) { |
111 | 111 | Request::getInstance()->redirect(Router::getInstance()->getRoute($notFoundRoute, true)); |
112 | - } else { |
|
112 | + }else { |
|
113 | 113 | return $template->render('error.html.twig', array( |
114 | 114 | 'exception' => $exception, |
115 | 115 | 'trace' => $exception->getTraceAsString(), |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | |
47 | 47 | $filePath = ''; |
48 | 48 | if (!file_exists($filePath)) { |
49 | - $filePath = BASE_DIR . $string; |
|
49 | + $filePath = BASE_DIR.$string; |
|
50 | 50 | } |
51 | 51 | $filenamePath = AssetsHelper::findDomainPath($string, $filePath); |
52 | 52 | |
53 | 53 | $filePath = self::processAsset($string, $name, $return, $filenamePath); |
54 | 54 | $basePath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl()); |
55 | - $returnPath = empty($name) ? $basePath . '/' . $filePath : $name; |
|
55 | + $returnPath = empty($name) ? $basePath.'/'.$filePath : $name; |
|
56 | 56 | return $return ? $returnPath : ''; |
57 | 57 | } |
58 | 58 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $router = Router::getInstance(); |
70 | 70 | try { |
71 | 71 | return $router->getRoute($path, $absolute, $params); |
72 | - } catch (\Exception $e) { |
|
72 | + }catch (\Exception $e) { |
|
73 | 73 | Logger::log($e->getMessage()); |
74 | 74 | return $router->getRoute('', $absolute, $params); |
75 | 75 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $filenamePath = self::extractPathname($path, $domains); |
166 | 166 | // Check if resources has been copied to public folders |
167 | 167 | if (!$debug) { |
168 | - $cacheFilename = Config::getParam('cache.var', '__initial__') . '.file.cache'; |
|
168 | + $cacheFilename = Config::getParam('cache.var', '__initial__').'.file.cache'; |
|
169 | 169 | $cachedFiles = Cache::getInstance()->readFromCache($cacheFilename, |
170 | 170 | 1, fn() => [], Cache::JSON, true) ?: []; |
171 | 171 | // Force the resource copy |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * |
187 | 187 | * @return string|array |
188 | 188 | */ |
189 | - private static function extractPathname(string $path, $domains): string|array |
|
189 | + private static function extractPathname(string $path, $domains): string | array |
|
190 | 190 | { |
191 | 191 | $filenamePath = $path; |
192 | 192 | if (!empty($domains) && !file_exists($path)) { |
@@ -225,13 +225,13 @@ discard block |
||
225 | 225 | * @param string $base |
226 | 226 | * @param string $filePath |
227 | 227 | */ |
228 | - private static function putResourceContent(string|null $name, string $filenamePath, string $base, string $filePath): void |
|
228 | + private static function putResourceContent(string | null $name, string $filenamePath, string $base, string $filePath): void |
|
229 | 229 | { |
230 | 230 | $data = file_get_contents($filenamePath); |
231 | 231 | if (!empty($name)) { |
232 | - file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data); |
|
233 | - } else { |
|
234 | - file_put_contents($base . $filePath, $data); |
|
232 | + file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data); |
|
233 | + }else { |
|
234 | + file_put_contents($base.$filePath, $data); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | * @return string |
245 | 245 | * @throws GeneratorException |
246 | 246 | */ |
247 | - private static function processAsset(string $string, string|null $name = null, bool $return = true, string $filenamePath = ''): string |
|
247 | + private static function processAsset(string $string, string | null $name = null, bool $return = true, string $filenamePath = ''): string |
|
248 | 248 | { |
249 | 249 | $filePath = $filenamePath; |
250 | 250 | if (file_exists($filenamePath)) { |
251 | 251 | list($base, $htmlBase, $filePath) = AssetsHelper::calculateAssetPath($string, $name, $return, $filenamePath); |
252 | 252 | //Creamos el directorio si no existe |
253 | - GeneratorHelper::createDir($base . $htmlBase); |
|
253 | + GeneratorHelper::createDir($base.$htmlBase); |
|
254 | 254 | //Si se ha modificado |
255 | - if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($filenamePath)) { |
|
255 | + if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($filenamePath)) { |
|
256 | 256 | if ($htmlBase === 'css') { |
257 | 257 | self::processCssLines($filenamePath); |
258 | 258 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function generateModule() |
36 | 36 | { |
37 | - Logger::log("Arranque generador de módulos al solicitar " . $this->getRequest()->getRequestUri()); |
|
37 | + Logger::log("Arranque generador de módulos al solicitar ".$this->getRequest()->getRequestUri()); |
|
38 | 38 | /* @var $form ConfigForm */ |
39 | 39 | $form = new ModuleForm(); |
40 | 40 | $form->build(); |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $this->gen->createStructureModule($module, false, $type, $apiClass); |
66 | 66 | Security::getInstance()->setFlash("callback_message", str_replace("%s", $module, t("Módulo %s generado correctamente"))); |
67 | 67 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-module", true)); |
68 | - } catch (Exception $e) { |
|
69 | - Logger::log($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]"); |
|
68 | + }catch (Exception $e) { |
|
69 | + Logger::log($e->getMessage()." [".$e->getFile().":".$e->getLine()."]"); |
|
70 | 70 | Security::getInstance()->setFlash("callback_message", htmlentities($e->getMessage())); |
71 | 71 | } |
72 | 72 | } |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | //Generating the templates translations |
45 | 45 | $translations = $this->tpl->regenerateTemplates(); |
46 | 46 | |
47 | - $localePath = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
48 | - $localePath .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR; |
|
47 | + $localePath = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
48 | + $localePath .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR; |
|
49 | 49 | |
50 | 50 | //xgettext localizations |
51 | 51 | $translations = array_merge($translations, I18nHelper::findTranslations(SOURCE_DIR, $locale)); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $translations = array_merge($translations, I18nHelper::findTranslations(CACHE_DIR, $locale)); |
54 | 54 | |
55 | 55 | $translations[] = "msgfmt {$localePath}translations.po -o {$localePath}translations.mo"; |
56 | - $translations[] = shell_exec('export PATH=\$PATH:/opt/local/bin:/bin:/sbin; msgfmt ' . $localePath . 'translations.po -o ' . $localePath . 'translations.mo'); |
|
56 | + $translations[] = shell_exec('export PATH=\$PATH:/opt/local/bin:/bin:/sbin; msgfmt '.$localePath.'translations.po -o '.$localePath.'translations.mo'); |
|
57 | 57 | return $this->render('translations.html.twig', array( |
58 | 58 | 'translations' => $translations, |
59 | 59 | )); |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function getConnectionManager(string $module, string $path): array |
26 | 26 | { |
27 | - $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $path . $module); |
|
27 | + $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $path.$module); |
|
28 | 28 | $generatorConfig = $this->getConfigGenerator($modulePath); |
29 | 29 | |
30 | 30 | $manager = new MigrationManager(); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $migrationFileName = $manager->getMigrationFileName($timestamp); |
116 | 116 | $migrationClassBody = $manager->getMigrationClassBody($migrationsUp, $migrationsDown, $timestamp); |
117 | 117 | |
118 | - $file = $generatorConfig->getSection('paths')['migrationDir'] . DIRECTORY_SEPARATOR . $migrationFileName; |
|
118 | + $file = $generatorConfig->getSection('paths')['migrationDir'].DIRECTORY_SEPARATOR.$migrationFileName; |
|
119 | 119 | file_put_contents($file, $migrationClassBody); |
120 | 120 | |
121 | 121 | Logger::log(sprintf('"%s" file successfully created.', $file)); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function createStructureModule(string $module, bool $force = false, string $type = "", string $apiClass = "", bool $skipMigration = false): void |
51 | 51 | { |
52 | - $modPath = CORE_DIR . DIRECTORY_SEPARATOR; |
|
52 | + $modPath = CORE_DIR.DIRECTORY_SEPARATOR; |
|
53 | 53 | $module = ucfirst($module); |
54 | 54 | $this->createModulePath($module, $modPath); |
55 | 55 | $this->createModulePathTree($module, $modPath); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | private function createModuleBaseFiles($module, $modPath, $force = false, $controllerType = '') |
75 | 75 | { |
76 | - $modulePath = $modPath . $module; |
|
76 | + $modulePath = $modPath.$module; |
|
77 | 77 | $this->generateControllerTemplate($module, $modulePath, $force, $controllerType); |
78 | 78 | $this->generateServiceTemplate($module, $modulePath, $force); |
79 | 79 | $this->generateSchemaTemplate($module, $modulePath, $force); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $this->genereateAutoloaderTemplate($module, $modulePath, $force); |
95 | 95 | $this->generatePropertiesTemplate($module, $modulePath, $force); |
96 | 96 | $this->generateConfigTemplate($modulePath, $force); |
97 | - $this->createModuleModels($module, CORE_DIR . DIRECTORY_SEPARATOR); |
|
97 | + $this->createModuleModels($module, CORE_DIR.DIRECTORY_SEPARATOR); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -114,26 +114,26 @@ discard block |
||
114 | 114 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
115 | 115 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
116 | 116 | "class" => $class, |
117 | - "controllerType" => $class . "Base", |
|
117 | + "controllerType" => $class."Base", |
|
118 | 118 | "is_base" => false |
119 | 119 | )); |
120 | - $controller = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" . |
|
121 | - DIRECTORY_SEPARATOR . "{$class}Controller.php", $force); |
|
120 | + $controller = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller". |
|
121 | + DIRECTORY_SEPARATOR."{$class}Controller.php", $force); |
|
122 | 122 | |
123 | 123 | $controllerBody = $this->tpl->dump("generator/controller.template.twig", array( |
124 | 124 | "module" => $module, |
125 | 125 | "namespace" => preg_replace('/(\\\|\/)/', '\\', $module), |
126 | 126 | "url" => preg_replace('/(\\\|\/)/', '/', $module), |
127 | - "class" => $class . "Base", |
|
127 | + "class" => $class."Base", |
|
128 | 128 | "service" => $class, |
129 | 129 | "controllerType" => $controllerType, |
130 | 130 | "is_base" => true, |
131 | 131 | "domain" => $class, |
132 | 132 | )); |
133 | - $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath . DIRECTORY_SEPARATOR . "Controller" . |
|
134 | - DIRECTORY_SEPARATOR . "base" . DIRECTORY_SEPARATOR . "{$class}BaseController.php", true); |
|
133 | + $controllerBase = $this->writeTemplateToFile($controllerBody, $modPath.DIRECTORY_SEPARATOR."Controller". |
|
134 | + DIRECTORY_SEPARATOR."base".DIRECTORY_SEPARATOR."{$class}BaseController.php", true); |
|
135 | 135 | |
136 | - $filename = $modPath . DIRECTORY_SEPARATOR . "Test" . DIRECTORY_SEPARATOR . "{$class}Test.php"; |
|
136 | + $filename = $modPath.DIRECTORY_SEPARATOR."Test".DIRECTORY_SEPARATOR."{$class}Test.php"; |
|
137 | 137 | $test = true; |
138 | 138 | if (!file_exists($filename)) { |
139 | 139 | $testTemplate = $this->tpl->dump("generator/testCase.template.twig", array( |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | private function createModuleModels($module, $path) |
156 | 156 | { |
157 | - $modulePath = str_replace(CORE_DIR . DIRECTORY_SEPARATOR, '', $path . $module); |
|
157 | + $modulePath = str_replace(CORE_DIR.DIRECTORY_SEPARATOR, '', $path.$module); |
|
158 | 158 | $configGenerator = $this->getConfigGenerator($modulePath); |
159 | 159 | |
160 | 160 | $this->buildModels($configGenerator); |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | $configTemplate = $this->tpl->dump("generator/config.propel.template.twig", array( |
164 | 164 | "module" => $module, |
165 | 165 | )); |
166 | - $this->writeTemplateToFile($configTemplate, CORE_DIR . DIRECTORY_SEPARATOR . $modulePath . DIRECTORY_SEPARATOR . "Config" . |
|
167 | - DIRECTORY_SEPARATOR . "config.php", true); |
|
166 | + $this->writeTemplateToFile($configTemplate, CORE_DIR.DIRECTORY_SEPARATOR.$modulePath.DIRECTORY_SEPARATOR."Config". |
|
167 | + DIRECTORY_SEPARATOR."config.php", true); |
|
168 | 168 | Logger::log("Generado config genérico para propel"); |
169 | 169 | } |
170 | 170 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | |
200 | 200 | if ($totalNbTables) { |
201 | 201 | Logger::log(sprintf('%d tables found in all databases.', $totalNbTables)); |
202 | - } else { |
|
202 | + }else { |
|
203 | 203 | Logger::log('No table found in all databases'); |
204 | 204 | } |
205 | 205 | |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | private function generateBaseApiTemplate($module, $modPath, $force = false, $apiClass = "") |
257 | 257 | { |
258 | 258 | $created = true; |
259 | - $modelPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
260 | - $apiPath = $modPath . $module . DIRECTORY_SEPARATOR . 'Api'; |
|
259 | + $modelPath = $modPath.$module.DIRECTORY_SEPARATOR.'Models'; |
|
260 | + $apiPath = $modPath.$module.DIRECTORY_SEPARATOR.'Api'; |
|
261 | 261 | if (file_exists($modelPath)) { |
262 | 262 | $dir = dir($modelPath); |
263 | 263 | $this->generateApiFiles($module, $force, $apiClass, $dir, $apiPath); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | //Generamos el fichero de configuración |
276 | 276 | Logger::log("Generamos fichero vacío de configuración"); |
277 | 277 | return $this->writeTemplateToFile("<?php\n\t", |
278 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", |
|
278 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", |
|
279 | 279 | $force); |
280 | 280 | } |
281 | 281 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | "db" => $this->config->get("db_name"), |
297 | 297 | )); |
298 | 298 | return $this->writeTemplateToFile($schema, |
299 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", |
|
299 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", |
|
300 | 300 | $force); |
301 | 301 | } |
302 | 302 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | "namespace" => preg_replace('/(\\\|\/)/', '', $module), |
315 | 315 | )); |
316 | 316 | return $this->writeTemplateToFile($buildProperties, |
317 | - $modPath . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.php", |
|
317 | + $modPath.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.php", |
|
318 | 318 | $force); |
319 | 319 | } |
320 | 320 | |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | "module" => $module, |
333 | 333 | )); |
334 | 334 | return $this->writeTemplateToFile($index, |
335 | - $modPath . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", |
|
335 | + $modPath.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", |
|
336 | 336 | $force); |
337 | 337 | } |
338 | 338 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | )); |
363 | 363 | |
364 | 364 | return $this->writeTemplateToFile($controller, |
365 | - $modPath . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
365 | + $modPath.DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | "package" => $package, |
388 | 388 | )); |
389 | 389 | |
390 | - return $this->writeTemplateToFile($controller, $modPath . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
390 | + return $this->writeTemplateToFile($controller, $modPath.DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
@@ -404,9 +404,9 @@ discard block |
||
404 | 404 | $base = $dir->path; |
405 | 405 | while ($file = $dir->read()) { |
406 | 406 | if (!in_array(strtolower($file), ['.', '..', 'base', 'map'])) { |
407 | - if (is_dir($base . DIRECTORY_SEPARATOR . $file)) { |
|
408 | - $this->generateApiFiles($module, $force, $apiClass, dir($base . DIRECTORY_SEPARATOR . $file), $apiPath . DIRECTORY_SEPARATOR . $file, $file); |
|
409 | - } else if (!preg_match('/Query\.php$/i', $file) |
|
407 | + if (is_dir($base.DIRECTORY_SEPARATOR.$file)) { |
|
408 | + $this->generateApiFiles($module, $force, $apiClass, dir($base.DIRECTORY_SEPARATOR.$file), $apiPath.DIRECTORY_SEPARATOR.$file, $file); |
|
409 | + }else if (!preg_match('/Query\.php$/i', $file) |
|
410 | 410 | && !preg_match('/I18n\.php$/i', $file) |
411 | 411 | && preg_match('/\.php$/i', $file) |
412 | 412 | ) { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $parts[] = $package; |
436 | 436 | } |
437 | 437 | $parts[] = $filename; |
438 | - $namespace = '\\' . implode('\\', $parts); |
|
438 | + $namespace = '\\'.implode('\\', $parts); |
|
439 | 439 | $reflectorClass = new \ReflectionClass($namespace); |
440 | 440 | $isModel = $reflectorClass->isInstantiable(); |
441 | 441 | return $isModel; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function init() |
55 | 55 | { |
56 | 56 | parent::init(); |
57 | - Logger::log(static::class . ' init', LOG_DEBUG); |
|
57 | + Logger::log(static::class.' init', LOG_DEBUG); |
|
58 | 58 | $this->domain = $this->getDomain(); |
59 | 59 | $this->hydrateRequestData(); |
60 | 60 | $this->hydrateOrders(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | $this->checkFieldType(); |
65 | 65 | $this->setLoaded(true); |
66 | - Logger::log(static::class . ' loaded', LOG_DEBUG); |
|
66 | + Logger::log(static::class.' loaded', LOG_DEBUG); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | private function checkActions($method) |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | $status = 200; |
160 | 160 | $saved = TRUE; |
161 | 161 | $model = $this->model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true); |
162 | - } else { |
|
162 | + }else { |
|
163 | 163 | $message = t('No se ha podido guardar el modelo seleccionado'); |
164 | 164 | } |
165 | - } catch (\Exception $e) { |
|
166 | - $message = t('Ha ocurrido un error intentando guardar el elemento: ') . '<br>' . $e->getMessage(); |
|
165 | + }catch (\Exception $e) { |
|
166 | + $message = t('Ha ocurrido un error intentando guardar el elemento: ').'<br>'.$e->getMessage(); |
|
167 | 167 | $context = []; |
168 | 168 | if (null !== $e->getPrevious()) { |
169 | 169 | $context[] = $e->getPrevious()->getMessage(); |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | $updated = TRUE; |
202 | 202 | $status = 200; |
203 | 203 | $model = $this->model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true); |
204 | - } else { |
|
204 | + }else { |
|
205 | 205 | $message = t('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs'); |
206 | 206 | } |
207 | - } catch (\Exception $e) { |
|
207 | + }catch (\Exception $e) { |
|
208 | 208 | $message = t('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs'); |
209 | 209 | $context = []; |
210 | 210 | if (null !== $e->getPrevious()) { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | Logger::log($e->getMessage(), LOG_CRIT, $context); |
214 | 214 | } |
215 | - } else { |
|
215 | + }else { |
|
216 | 216 | $message = t('No se ha encontrado el modelo al que se hace referencia para actualizar'); |
217 | 217 | } |
218 | 218 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $this->model->delete($this->con); |
247 | 247 | $deleted = TRUE; |
248 | 248 | } |
249 | - } catch (\Exception $e) { |
|
249 | + }catch (\Exception $e) { |
|
250 | 250 | $context = []; |
251 | 251 | if (null !== $e->getPrevious()) { |
252 | 252 | $context[] = $e->getPrevious()->getMessage(); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $this->saveBulk(); |
279 | 279 | $saved = true; |
280 | 280 | $status = 200; |
281 | - } catch (\Exception $e) { |
|
281 | + }catch (\Exception $e) { |
|
282 | 282 | Logger::log($e->getMessage(), LOG_CRIT, $this->getRequest()->getData()); |
283 | 283 | $message = t('Bulk insert rolled back'); |
284 | 284 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if (null !== $this->list) { |
311 | 311 | if (array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) { |
312 | 312 | $return = $this->extractDataWithFormat(); |
313 | - } else { |
|
313 | + }else { |
|
314 | 314 | $return = $this->list->toArray(null, false, $this->fieldType ?: TableMap::TYPE_PHPNAME, false); |
315 | 315 | } |
316 | 316 | $total = 0; |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | $pages = 1; |
324 | 324 | } |
325 | 325 | } |
326 | - } catch (\Exception $e) { |
|
327 | - Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR); |
|
326 | + }catch (\Exception $e) { |
|
327 | + Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | return array($return, $total, $pages); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $return = array(); |
343 | 343 | if (NULL === $model || !method_exists($model, 'toArray')) { |
344 | 344 | $code = 404; |
345 | - } else { |
|
345 | + }else { |
|
346 | 346 | $return = $model->toArray($this->fieldType ?: TableMap::TYPE_PHPNAME, true, [], true); |
347 | 347 | } |
348 | 348 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $vars['__profiling__'] = Inspector::getStats(); |
43 | 43 | } |
44 | 44 | $domain = (null === $domain) ? $this->getDomain() : $domain; |
45 | - return $this->tpl->render($domain . $template, $vars, $cookies); |
|
45 | + return $this->tpl->render($domain.$template, $vars, $cookies); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $vars['__menu__'] = $this->getMenu(); |
75 | 75 | $domain = $domain ?: $this->getDomain(); |
76 | - return $this->tpl->dump($domain . $template, $vars); |
|
76 | + return $this->tpl->dump($domain.$template, $vars); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -98,7 +98,7 @@ |
||
98 | 98 | { |
99 | 99 | $this->params = []; |
100 | 100 | $this->headers = []; |
101 | - Logger::log('Context service for ' . static::class . ' cleared!'); |
|
101 | + Logger::log('Context service for '.static::class.' cleared!'); |
|
102 | 102 | $this->closeConnection(); |
103 | 103 | } |
104 | 104 |