@@ -160,7 +160,7 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
163 | - * @param $field |
|
163 | + * @param string $field |
|
164 | 164 | * @param bool $required |
165 | 165 | * @return Field |
166 | 166 | */ |
@@ -31,19 +31,19 @@ discard block |
||
31 | 31 | $behaviors = $tableMap->getBehaviors(); |
32 | 32 | foreach ($map::getFieldNames() as $field) { |
33 | 33 | $fDto = self::parseFormField($domain, $tableMap, $field, $behaviors); |
34 | - if(null !== $fDto) { |
|
34 | + if (null !== $fDto) { |
|
35 | 35 | $form->addField($fDto); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | - if(array_key_exists('i18n', $behaviors)) { |
|
40 | - $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n'); |
|
41 | - if(null !== $relateI18n) { |
|
39 | + if (array_key_exists('i18n', $behaviors)) { |
|
40 | + $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n'); |
|
41 | + if (null !== $relateI18n) { |
|
42 | 42 | $i18NTableMap = $relateI18n->getLocalTable(); |
43 | - foreach($i18NTableMap->getColumns() as $columnMap) { |
|
44 | - if(!$form->fieldExists($columnMap->getPhpName())) { |
|
43 | + foreach ($i18NTableMap->getColumns() as $columnMap) { |
|
44 | + if (!$form->fieldExists($columnMap->getPhpName())) { |
|
45 | 45 | $fDto = self::parseFormField($domain, $i18NTableMap, $columnMap->getPhpName(), $i18NTableMap->getBehaviors()); |
46 | - if(null !== $fDto) { |
|
46 | + if (null !== $fDto) { |
|
47 | 47 | $fDto->pk = false; |
48 | 48 | $form->addField($fDto); |
49 | 49 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $fDto->entity = $relatedModel; |
73 | 73 | $relatedField = $foreignTable->getColumn($mappedColumn->getRelatedColumnName()); |
74 | 74 | $fDto->relatedField = $relatedField->getPhpName(); |
75 | - $fDto->url = Router::getInstance()->getRoute(strtolower($domain) . '-api-' . $relatedModel); |
|
75 | + $fDto->url = Router::getInstance()->getRoute(strtolower($domain).'-api-'.$relatedModel); |
|
76 | 76 | return $fDto; |
77 | 77 | } |
78 | 78 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $column = null; |
181 | 181 | try { |
182 | 182 | $column = $tableMap->getColumnByPhpName($field); |
183 | - } catch (\Exception $e) { |
|
183 | + }catch (\Exception $e) { |
|
184 | 184 | Logger::log($e->getMessage(), LOG_WARNING); |
185 | 185 | //foreach($tableMap->getRelations() as $relation) { |
186 | 186 | // $column = self::checkFieldExists($relation->getLocalTable(), $field); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param ModelCriteria $query |
195 | 195 | * @param mixed $value |
196 | 196 | */ |
197 | - private static function addQueryFilter(ColumnMap $column, ModelCriteria &$query, $value = null) |
|
197 | + private static function addQueryFilter(ColumnMap $column, ModelCriteria & $query, $value = null) |
|
198 | 198 | { |
199 | 199 | $tableField = $column->getFullyQualifiedName(); |
200 | 200 | if (preg_match('/^<=/', $value)) { |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | } elseif (preg_match('/^(\'|\")(.*)(\'|\")$/', $value)) { |
211 | 211 | $text = preg_replace('/(\'|\")/', '', $value); |
212 | 212 | $text = preg_replace('/\ /', '%', $text); |
213 | - $query->add($tableField, '%' . $text . '%', Criteria::LIKE); |
|
214 | - } else { |
|
213 | + $query->add($tableField, '%'.$text.'%', Criteria::LIKE); |
|
214 | + }else { |
|
215 | 215 | $query->add($tableField, $value, Criteria::EQUAL); |
216 | 216 | } |
217 | 217 | } |
@@ -222,35 +222,35 @@ discard block |
||
222 | 222 | * @param array $extraColumns |
223 | 223 | * @param mixed $value |
224 | 224 | */ |
225 | - public static function composerComboField(TableMap $tableMap, ModelCriteria &$query, array $extraColumns = [], $value = null) |
|
225 | + public static function composerComboField(TableMap $tableMap, ModelCriteria & $query, array $extraColumns = [], $value = null) |
|
226 | 226 | { |
227 | 227 | $exp = 'CONCAT('; |
228 | 228 | $sep = ''; |
229 | 229 | foreach ($tableMap->getColumns() as $column) { |
230 | 230 | if ($column->isText()) { |
231 | - $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")'; |
|
231 | + $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")'; |
|
232 | 232 | $sep = ', " ", '; |
233 | 233 | } |
234 | 234 | } |
235 | - foreach($tableMap->getRelations() as $relation) { |
|
236 | - if(preg_match('/I18n$/i', $relation->getName())) { |
|
235 | + foreach ($tableMap->getRelations() as $relation) { |
|
236 | + if (preg_match('/I18n$/i', $relation->getName())) { |
|
237 | 237 | $localeTableMap = $relation->getLocalTable(); |
238 | 238 | foreach ($localeTableMap->getColumns() as $column) { |
239 | 239 | if ($column->isText()) { |
240 | - $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")'; |
|
240 | + $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")'; |
|
241 | 241 | $sep = ', " ", '; |
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
245 | 245 | } |
246 | 246 | foreach ($extraColumns as $extra => $name) { |
247 | - $exp .= $sep . $extra; |
|
247 | + $exp .= $sep.$extra; |
|
248 | 248 | $sep = ', " ", '; |
249 | 249 | } |
250 | 250 | $exp .= ")"; |
251 | 251 | $text = preg_replace('/(\'|\")/', '', $value); |
252 | 252 | $text = preg_replace('/\ /', '%', $text); |
253 | - $query->where($exp . Criteria::LIKE . '"%' . $text . '%"'); |
|
253 | + $query->where($exp.Criteria::LIKE.'"%'.$text.'%"'); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @param string $field |
261 | 261 | * @param mixed $value |
262 | 262 | */ |
263 | - public static function addModelField(TableMap $tableMap, ModelCriteria &$query, $field, $value = null) |
|
263 | + public static function addModelField(TableMap $tableMap, ModelCriteria & $query, $field, $value = null) |
|
264 | 264 | { |
265 | 265 | if ($column = self::checkFieldExists($tableMap, $field)) { |
266 | 266 | self::addQueryFilter($column, $query, $value); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | */ |
276 | 276 | public static function extractQuery($modelNameNamespace, ConnectionInterface $con = null) |
277 | 277 | { |
278 | - $queryReflector = new \ReflectionClass($modelNameNamespace . "Query"); |
|
278 | + $queryReflector = new \ReflectionClass($modelNameNamespace."Query"); |
|
279 | 279 | /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */ |
280 | 280 | $query = $queryReflector->getMethod('create')->invoke($con); |
281 | 281 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } elseif ($mappedColumn->isText()) { |
305 | 305 | if ($mappedColumn->getSize() > 100) { |
306 | 306 | $fDto = self::createField($field, Field::TEXTAREA_TYPE, $required); |
307 | - } else { |
|
307 | + }else { |
|
308 | 308 | $fDto = self::generateStringField($field, $required); |
309 | 309 | } |
310 | 310 | } elseif ($mappedColumn->getType() === PropelTypes::BOOLEAN) { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Method that extract the Api name |
42 | - * @return mixed |
|
42 | + * @return string |
|
43 | 43 | */ |
44 | 44 | public function getApi() |
45 | 45 | { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Method that extract the Domain name |
53 | - * @return mixed |
|
53 | + * @return string |
|
54 | 54 | */ |
55 | 55 | public function getDomain() |
56 | 56 | { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @param ModelCriteria $query |
95 | 95 | */ |
96 | - protected function joinTables(ModelCriteria &$query) |
|
96 | + protected function joinTables(ModelCriteria & $query) |
|
97 | 97 | { |
98 | 98 | //TODO for specific implementations |
99 | 99 | } |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | */ |
107 | 107 | protected function findPk(ModelCriteria $query, $pk) { |
108 | 108 | $pks = explode(Api::API_PK_SEPARATOR, urldecode($pk)); |
109 | - if(count($pks) == 1 && !empty($pks[0])) { |
|
109 | + if (count($pks) == 1 && !empty($pks[0])) { |
|
110 | 110 | $model = $query->findPk($pks[0], $this->con); |
111 | - } else { |
|
111 | + }else { |
|
112 | 112 | $i = 0; |
113 | - foreach($this->getPkDbName() as $key => $phpName) { |
|
113 | + foreach ($this->getPkDbName() as $key => $phpName) { |
|
114 | 114 | try { |
115 | 115 | $query->filterBy($phpName, $pks[$i]); |
116 | 116 | $i++; |
117 | - if($i >= count($pks)) break; |
|
118 | - } catch(\Exception $e) { |
|
117 | + if ($i >= count($pks)) break; |
|
118 | + }catch (\Exception $e) { |
|
119 | 119 | Logger::log($e->getMessage(), LOG_DEBUG); |
120 | 120 | } |
121 | 121 | } |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | try { |
146 | 146 | $query = $this->prepareQuery(); |
147 | 147 | $this->model = $this->findPk($query, $pk); |
148 | - } catch (\Exception $e) { |
|
149 | - Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR); |
|
148 | + }catch (\Exception $e) { |
|
149 | + Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * @param ModelCriteria $query |
169 | 169 | */ |
170 | - protected function checkReturnFields(ModelCriteria &$query) |
|
170 | + protected function checkReturnFields(ModelCriteria & $query) |
|
171 | 171 | { |
172 | 172 | $returnFields = Request::getInstance()->getQuery(Api::API_FIELDS_RESULT_FIELD); |
173 | 173 | if (null !== $returnFields) { |
@@ -114,7 +114,9 @@ |
||
114 | 114 | try { |
115 | 115 | $query->filterBy($phpName, $pks[$i]); |
116 | 116 | $i++; |
117 | - if($i >= count($pks)) break; |
|
117 | + if($i >= count($pks)) { |
|
118 | + break; |
|
119 | + } |
|
118 | 120 | } catch(\Exception $e) { |
119 | 121 | Logger::log($e->getMessage(), LOG_DEBUG); |
120 | 122 | } |
@@ -48,7 +48,7 @@ |
||
48 | 48 | return ($aOrder < $bOrder) ? -1 : 1; |
49 | 49 | }); |
50 | 50 | $array['actions'] = []; |
51 | - foreach($this->actions as $action) { |
|
51 | + foreach ($this->actions as $action) { |
|
52 | 52 | $array['actions'][] = $action->__toArray(); |
53 | 53 | } |
54 | 54 | return $array; |
@@ -44,7 +44,7 @@ |
||
44 | 44 | header("Access-Control-Allow-Credentials: true"); |
45 | 45 | header("Access-Control-Allow-Origin: *"); |
46 | 46 | header("Access-Control-Allow-Methods: GET, POST, DELETE, PUT, PATCH, OPTIONS"); |
47 | - header("Access-Control-Allow-Headers: " . implode(', ', self::getCorsHeaders())); |
|
47 | + header("Access-Control-Allow-Headers: ".implode(', ', self::getCorsHeaders())); |
|
48 | 48 | } |
49 | 49 | if (Request::getInstance()->getMethod() == 'OPTIONS') { |
50 | 50 | Logger::log('Returning OPTIONS header confirmation for CORS pre flight requests', LOG_DEBUG); |
@@ -39,8 +39,8 @@ |
||
39 | 39 | "domain" => $this->getDomain(), |
40 | 40 | "listLabel" => Api::API_LIST_NAME_FIELD, |
41 | 41 | 'modelId' => Api::API_MODEL_KEY_FIELD, |
42 | - 'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-' . $this->getDomain() . '-' . $this->getApi()), TRUE)), |
|
43 | - "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain() . '-' . 'api-' . $this->getApi() . "-pk"), TRUE)), |
|
42 | + 'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-'.$this->getDomain().'-'.$this->getApi()), TRUE)), |
|
43 | + "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain().'-'.'api-'.$this->getApi()."-pk"), TRUE)), |
|
44 | 44 | ), [], ''); |
45 | 45 | } |
46 | 46 |
@@ -6,7 +6,6 @@ |
||
6 | 6 | use Propel\Runtime\Propel; |
7 | 7 | use PSFS\base\config\Config; |
8 | 8 | use PSFS\base\Logger; |
9 | -use PSFS\base\types\traits\DebugTrait; |
|
10 | 9 | |
11 | 10 | /** |
12 | 11 | * Trait ConnectionTrait |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | protected function createConnection(TableMap $tableMap) |
27 | 27 | { |
28 | 28 | $this->con = Propel::getConnection($tableMap::DATABASE_NAME); |
29 | - if(method_exists($this->con, 'useDebug')) { |
|
29 | + if (method_exists($this->con, 'useDebug')) { |
|
30 | 30 | Logger::log('Enabling debug queries mode', LOG_INFO); |
31 | 31 | $this->con->useDebug(Config::getParam('debug')); |
32 | 32 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | if (null !== $this->con && $this->con->inTransaction()) { |
44 | 44 | if ($status === 200) { |
45 | 45 | $this->con->commit(); |
46 | - } else { |
|
46 | + }else { |
|
47 | 47 | $this->con->rollBack(); |
48 | 48 | } |
49 | 49 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $this->success = $result; |
43 | 43 | $this->total = $total ?: count($data); |
44 | 44 | $this->pages = $pages; |
45 | - if(null !== $message) { |
|
45 | + if (null !== $message) { |
|
46 | 46 | $this->message = $message; |
47 | 47 | } |
48 | 48 | } |
@@ -3,15 +3,12 @@ |
||
3 | 3 | |
4 | 4 | use Propel\Runtime\ActiveQuery\ModelCriteria; |
5 | 5 | use Propel\Runtime\Map\TableMap; |
6 | -use PSFS\base\config\Config; |
|
7 | 6 | use PSFS\base\dto\JsonResponse; |
8 | 7 | use PSFS\base\dto\Order; |
9 | 8 | use PSFS\base\Logger; |
10 | 9 | use PSFS\base\Request; |
11 | -use PSFS\base\Security; |
|
12 | 10 | use PSFS\base\Singleton; |
13 | 11 | use PSFS\base\types\helpers\ApiHelper; |
14 | -use PSFS\base\types\helpers\Inspector; |
|
15 | 12 | use PSFS\base\types\traits\Api\ManagerTrait; |
16 | 13 | |
17 | 14 | /** |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | public function init() |
73 | 73 | { |
74 | 74 | parent::init(); |
75 | - Logger::log(get_called_class() . ' init', LOG_DEBUG); |
|
75 | + Logger::log(get_called_class().' init', LOG_DEBUG); |
|
76 | 76 | $this->domain = $this->getDomain(); |
77 | 77 | $this->hydrateRequestData(); |
78 | 78 | $this->hydrateOrders(); |
79 | 79 | $this->createConnection($this->getTableMap()); |
80 | 80 | $this->setLoaded(true); |
81 | - Logger::log(get_called_class() . ' loaded', LOG_DEBUG); |
|
81 | + Logger::log(get_called_class().' loaded', LOG_DEBUG); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | private function hydrateOrders() |
88 | 88 | { |
89 | 89 | if (count($this->query)) { |
90 | - Logger::log(get_called_class() . ' gathering query string', LOG_DEBUG); |
|
90 | + Logger::log(get_called_class().' gathering query string', LOG_DEBUG); |
|
91 | 91 | foreach ($this->query as $key => $value) { |
92 | 92 | if ($key === self::API_ORDER_FIELD) { |
93 | 93 | foreach ($value as $field => $direction) { |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function extractPagination() |
106 | 106 | { |
107 | - Logger::log(get_called_class() . ' extract pagination start', LOG_DEBUG); |
|
107 | + Logger::log(get_called_class().' extract pagination start', LOG_DEBUG); |
|
108 | 108 | $page = (array_key_exists(self::API_PAGE_FIELD, $this->query)) ? $this->query[self::API_PAGE_FIELD] : 1; |
109 | 109 | $limit = (array_key_exists(self::API_LIMIT_FIELD, $this->query)) ? $this->query[self::API_LIMIT_FIELD] : 100; |
110 | - Logger::log(get_called_class() . ' extract pagination end', LOG_DEBUG); |
|
110 | + Logger::log(get_called_class().' extract pagination end', LOG_DEBUG); |
|
111 | 111 | return array($page, $limit); |
112 | 112 | } |
113 | 113 | |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @param ModelCriteria $query |
118 | 118 | */ |
119 | - private function addOrders(ModelCriteria &$query) |
|
119 | + private function addOrders(ModelCriteria & $query) |
|
120 | 120 | { |
121 | - Logger::log(get_called_class() . ' extract orders start ', LOG_DEBUG); |
|
121 | + Logger::log(get_called_class().' extract orders start ', LOG_DEBUG); |
|
122 | 122 | $orderAdded = FALSE; |
123 | 123 | $tableMap = $this->getTableMap(); |
124 | 124 | foreach ($this->order->getOrders() as $field => $direction) { |
@@ -126,17 +126,17 @@ discard block |
||
126 | 126 | $orderAdded = TRUE; |
127 | 127 | if ($direction === Order::ASC) { |
128 | 128 | $query->addAscendingOrderByColumn($column->getPhpName()); |
129 | - } else { |
|
129 | + }else { |
|
130 | 130 | $query->addDescendingOrderByColumn($column->getPhpName()); |
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
134 | 134 | if (!$orderAdded) { |
135 | - foreach($this->getPkDbName() as $pk => $phpName) { |
|
135 | + foreach ($this->getPkDbName() as $pk => $phpName) { |
|
136 | 136 | $query->addAscendingOrderByColumn($pk); |
137 | 137 | } |
138 | 138 | } |
139 | - Logger::log(get_called_class() . ' extract orders end', LOG_DEBUG); |
|
139 | + Logger::log(get_called_class().' extract orders end', LOG_DEBUG); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @param ModelCriteria $query |
146 | 146 | */ |
147 | - protected function addFilters(ModelCriteria &$query) |
|
147 | + protected function addFilters(ModelCriteria & $query) |
|
148 | 148 | { |
149 | 149 | if (count($this->query) > 0) { |
150 | 150 | $tableMap = $this->getTableMap(); |
151 | 151 | foreach ($this->query as $field => $value) { |
152 | 152 | if (self::API_COMBO_FIELD === $field) { |
153 | 153 | ApiHelper::composerComboField($tableMap, $query, $this->extraColumns, $value); |
154 | - } elseif(!preg_match('/^__/', $field)) { |
|
154 | + } elseif (!preg_match('/^__/', $field)) { |
|
155 | 155 | ApiHelper::addModelField($tableMap, $query, $field, $value); |
156 | 156 | } |
157 | 157 | } |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | list($page, $limit) = $this->extractPagination(); |
173 | 173 | if ($limit == -1) { |
174 | 174 | $this->list = $query->find($this->con); |
175 | - } else { |
|
175 | + }else { |
|
176 | 176 | $this->list = $query->paginate($page, $limit, $this->con); |
177 | 177 | } |
178 | - } catch (\Exception $e) { |
|
178 | + }catch (\Exception $e) { |
|
179 | 179 | Logger::log($e->getMessage(), LOG_ERR); |
180 | 180 | } |
181 | 181 | } |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $code = 200; |
195 | 195 | list($return, $total, $pages) = $this->getList(); |
196 | 196 | $message = null; |
197 | - if(!$total) { |
|
197 | + if (!$total) { |
|
198 | 198 | $message = _('No se han encontrado elementos para la búsqueda'); |
199 | 199 | } |
200 | 200 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | $pages = 1; |
221 | 221 | $message = null; |
222 | 222 | list($code, $return) = $this->getSingleResult($pk); |
223 | - if($code !== 200) { |
|
223 | + if ($code !== 200) { |
|
224 | 224 | $message = _('No se ha encontrado el elemento solicitado'); |
225 | 225 | } |
226 | 226 | |
@@ -249,11 +249,11 @@ discard block |
||
249 | 249 | $status = 200; |
250 | 250 | $saved = TRUE; |
251 | 251 | $model = $this->model->toArray(); |
252 | - } else { |
|
252 | + }else { |
|
253 | 253 | $message = _('No se ha podido modificar el modelo seleccionado'); |
254 | 254 | } |
255 | - } catch (\Exception $e) { |
|
256 | - $message = _('Ha ocurrido un error intentando guardar el elemento: ') .'<br>'. $e->getMessage(); |
|
255 | + }catch (\Exception $e) { |
|
256 | + $message = _('Ha ocurrido un error intentando guardar el elemento: ').'<br>'.$e->getMessage(); |
|
257 | 257 | Logger::log($e->getMessage(), LOG_ERR); |
258 | 258 | } |
259 | 259 | |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | $updated = TRUE; |
288 | 288 | $status = 200; |
289 | 289 | $model = $this->model->toArray(); |
290 | - } else { |
|
290 | + }else { |
|
291 | 291 | $message = _('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs'); |
292 | 292 | } |
293 | - } catch (\Exception $e) { |
|
293 | + }catch (\Exception $e) { |
|
294 | 294 | $message = $e->getMessage(); |
295 | 295 | Logger::getInstance(get_class($this->model))->errorLog($e->getMessage()); |
296 | 296 | } |
297 | - } else { |
|
297 | + }else { |
|
298 | 298 | $message = _('No se ha encontrado el modelo al que se hace referencia para actualizar'); |
299 | 299 | } |
300 | 300 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $this->model->delete($this->con); |
325 | 325 | $deleted = TRUE; |
326 | 326 | } |
327 | - } catch (\Exception $e) { |
|
327 | + }catch (\Exception $e) { |
|
328 | 328 | $message = _('Ha ocurrido un error intentando eliminar el elemento, por favor verifica que no tenga otros elementos relacionados'); |
329 | 329 | Logger::getInstance(get_class($this->model))->errorLog($e->getMessage()); |
330 | 330 | } |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | $total = $this->list->getNbResults(); |
359 | 359 | $pages = $this->list->getLastPage(); |
360 | 360 | } |
361 | - } catch (\Exception $e) { |
|
362 | - Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR); |
|
361 | + }catch (\Exception $e) { |
|
362 | + Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | return array($return, $total, $pages); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $return = array(); |
378 | 378 | if (NULL === $model || !method_exists($model, 'toArray')) { |
379 | 379 | $code = 404; |
380 | - } else { |
|
380 | + }else { |
|
381 | 381 | $return = $model->toArray(); |
382 | 382 | } |
383 | 383 |
@@ -2,15 +2,11 @@ |
||
2 | 2 | namespace PSFS\base\types; |
3 | 3 | |
4 | 4 | use PSFS\base\config\Config; |
5 | -use PSFS\base\exception\RouterException; |
|
6 | -use PSFS\base\Request; |
|
7 | -use PSFS\base\Router; |
|
8 | 5 | use PSFS\base\Singleton; |
9 | 6 | use PSFS\base\types\helpers\GeneratorHelper; |
10 | 7 | use PSFS\base\types\helpers\Inspector; |
11 | 8 | use PSFS\base\types\interfaces\ControllerInterface; |
12 | 9 | use PSFS\base\types\traits\JsonTrait; |
13 | -use PSFS\base\types\traits\OutputTrait; |
|
14 | 10 | use PSFS\base\types\traits\RouteTrait; |
15 | 11 | |
16 | 12 | /** |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | public function render($template, array $vars = array(), $cookies = array(), $domain = null) |
42 | 42 | { |
43 | 43 | $vars['__menu__'] = $this->getMenu(); |
44 | - if(Config::getParam('profiling.enable')) { |
|
44 | + if (Config::getParam('profiling.enable')) { |
|
45 | 45 | $vars['__profiling__'] = Inspector::getStats(); |
46 | 46 | } |
47 | 47 | $domain = (null === $domain) ? $this->getDomain() : $domain; |
48 | - return $this->tpl->render($domain . $template, $vars, $cookies); |
|
48 | + return $this->tpl->render($domain.$template, $vars, $cookies); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $vars['__menu__'] = $this->getMenu(); |
78 | 78 | $domain = $domain ?: $this->getDomain(); |
79 | - return $this->tpl->dump($domain . $template, $vars); |
|
79 | + return $this->tpl->dump($domain.$template, $vars); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |