Test Failed
Push — master ( 8126a5...bf8723 )
by Fran
04:23
created
src/base/types/helpers/ApiHelper.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@
 block discarded – undo
160 160
     }
161 161
 
162 162
     /**
163
-     * @param $field
163
+     * @param string $field
164 164
      * @param bool $required
165 165
      * @return Field
166 166
      */
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,24 +222,24 @@  discard block
 block discarded – undo
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 235
         foreach ($extraColumns as $extra => $name) {
236
-            $exp .= $sep . $extra;
236
+            $exp .= $sep.$extra;
237 237
             $sep = ', " ", ';
238 238
         }
239 239
         $exp .= ")";
240 240
         $text = preg_replace('/(\'|\")/', '', $value);
241 241
         $text = preg_replace('/\ /', '%', $text);
242
-        $query->where($exp . Criteria::LIKE . '"%' . $text . '%"');
242
+        $query->where($exp.Criteria::LIKE.'"%'.$text.'%"');
243 243
     }
244 244
 
245 245
     /**
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @param string $field
250 250
      * @param mixed $value
251 251
      */
252
-    public static function addModelField(TableMap $tableMap, ModelCriteria &$query, $field, $value = null)
252
+    public static function addModelField(TableMap $tableMap, ModelCriteria & $query, $field, $value = null)
253 253
     {
254 254
         if ($column = self::checkFieldExists($tableMap, $field)) {
255 255
             self::addQueryFilter($column, $query, $value);
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
      */
265 265
     public static function extractQuery($modelNameNamespace, ConnectionInterface $con = null)
266 266
     {
267
-        $queryReflector = new \ReflectionClass($modelNameNamespace . "Query");
267
+        $queryReflector = new \ReflectionClass($modelNameNamespace."Query");
268 268
         /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */
269 269
         $query = $queryReflector->getMethod('create')->invoke($con);
270 270
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         } elseif ($mappedColumn->isText()) {
294 294
             if ($mappedColumn->getSize() > 100) {
295 295
                 $fDto = self::createField($field, Field::TEXTAREA_TYPE, $required);
296
-            } else {
296
+            }else {
297 297
                 $fDto = self::generateStringField($field, $required);
298 298
             }
299 299
         } elseif ($mappedColumn->getType() === PropelTypes::BOOLEAN) {
Please login to merge, or discard this patch.
src/base/types/traits/Api/ApiTrait.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
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,14 +106,14 @@  discard block
 block discarded – undo
106 106
      */
107 107
     private function findPk(ModelCriteria $query, $pk) {
108 108
         $pks = explode(Api::API_PK_SEPARATOR, urldecode($pk));
109
-        if(count($pks) == 1) {
109
+        if (count($pks) == 1) {
110 110
             return $query->findPk($pks[0]);
111
-        } else {
111
+        }else {
112 112
             $i = 0;
113
-            foreach($this->getPkDbName() as $key => $phpName) {
113
+            foreach ($this->getPkDbName() as $key => $phpName) {
114 114
                 $query->filterBy($phpName, $pks[$i]);
115 115
                 $i++;
116
-                if($i >= count($pks)) break;
116
+                if ($i >= count($pks)) break;
117 117
             }
118 118
             return $query->findOne();
119 119
         }
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
         try {
141 141
             $query = $this->prepareQuery();
142 142
             $this->model = $this->findPk($query, $pk);
143
-        } catch (\Exception $e) {
144
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
143
+        }catch (\Exception $e) {
144
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
145 145
         }
146 146
     }
147 147
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     /**
163 163
      * @param ModelCriteria $query
164 164
      */
165
-    private function checkReturnFields(ModelCriteria &$query)
165
+    private function checkReturnFields(ModelCriteria & $query)
166 166
     {
167 167
         $returnFields = Request::getInstance()->getQuery(Api::API_FIELDS_RESULT_FIELD);
168 168
         if (null !== $returnFields) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,9 @@
 block discarded – undo
113 113
             foreach($this->getPkDbName() as $key => $phpName) {
114 114
                 $query->filterBy($phpName, $pks[$i]);
115 115
                 $i++;
116
-                if($i >= count($pks)) break;
116
+                if($i >= count($pks)) {
117
+                    break;
118
+                }
117 119
             }
118 120
             return $query->findOne();
119 121
         }
Please login to merge, or discard this patch.
src/base/dto/Form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/base/types/helpers/RequestHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/base/types/traits/Api/ManagerTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/base/types/Api.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      *
115 115
      * @param ModelCriteria $query
116 116
      */
117
-    private function addOrders(ModelCriteria &$query)
117
+    private function addOrders(ModelCriteria & $query)
118 118
     {
119 119
         $orderAdded = FALSE;
120 120
         $tableMap = $this->getTableMap();
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
                 $orderAdded = TRUE;
124 124
                 if ($direction === Order::ASC) {
125 125
                     $query->addAscendingOrderByColumn($column->getPhpName());
126
-                } else {
126
+                }else {
127 127
                     $query->addDescendingOrderByColumn($column->getPhpName());
128 128
                 }
129 129
             }
130 130
         }
131 131
         if (!$orderAdded) {
132
-            foreach($this->getPkDbName() as $pk => $phpName) {
132
+            foreach ($this->getPkDbName() as $pk => $phpName) {
133 133
                 $query->addAscendingOrderByColumn($pk);
134 134
             }
135 135
         }
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
      *
141 141
      * @param ModelCriteria $query
142 142
      */
143
-    private function addFilters(ModelCriteria &$query)
143
+    private function addFilters(ModelCriteria & $query)
144 144
     {
145 145
         if (count($this->query) > 0) {
146 146
             $tableMap = $this->getTableMap();
147 147
             foreach ($this->query as $field => $value) {
148 148
                 if (self::API_COMBO_FIELD === $field) {
149 149
                     ApiHelper::composerComboField($tableMap, $query, $this->extraColumns, $value);
150
-                } elseif(!preg_match('/^__/', $field)) {
150
+                } elseif (!preg_match('/^__/', $field)) {
151 151
                     ApiHelper::addModelField($tableMap, $query, $field, $value);
152 152
                 }
153 153
             }
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
             list($page, $limit) = $this->extractPagination();
169 169
             if ($limit == -1) {
170 170
                 $this->list = $query->find($this->con);
171
-            } else {
171
+            }else {
172 172
                 $this->list = $query->paginate($page, $limit, $this->con);
173 173
             }
174
-        } catch (\Exception $e) {
174
+        }catch (\Exception $e) {
175 175
             Logger::log($e->getMessage(), LOG_ERR);
176 176
         }
177 177
     }
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
                 $saved = TRUE;
238 238
                 $model = $this->model->toArray();
239 239
             }
240
-        } catch (\Exception $e) {
241
-            $model = _('Ha ocurrido un error intentando guardar el elemento: ') . $e->getMessage();
240
+        }catch (\Exception $e) {
241
+            $model = _('Ha ocurrido un error intentando guardar el elemento: ').$e->getMessage();
242 242
             Logger::log($e->getMessage(), LOG_ERR);
243 243
         }
244 244
 
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
                     $updated = TRUE;
272 272
                     $status = 200;
273 273
                     $model = $this->model->toArray();
274
-                } else {
274
+                }else {
275 275
                     $model = _('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
276 276
                 }
277
-            } catch (\Exception $e) {
277
+            }catch (\Exception $e) {
278 278
                 $model = $e->getMessage();
279 279
                 Logger::getInstance(get_class($this->model))->errorLog($e->getMessage());
280 280
             }
281
-        } else {
281
+        }else {
282 282
             $model = _('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
283 283
         }
284 284
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
                     $this->model->delete($this->con);
309 309
                     $deleted = TRUE;
310 310
                 }
311
-            } catch (\Exception $e) {
311
+            }catch (\Exception $e) {
312 312
                 $message = _('Ha ocurrido un error intentando eliminar el elemento, por favor verifica que no tenga otros elementos relacionados');
313 313
                 Logger::getInstance(get_class($this->model))->errorLog($e->getMessage());
314 314
             }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                 $total = $this->list->getNbResults();
343 343
                 $pages = $this->list->getLastPage();
344 344
             }
345
-        } catch (\Exception $e) {
345
+        }catch (\Exception $e) {
346 346
             Logger::getInstance(get_class($this))->errorLog($e->getMessage());
347 347
         }
348 348
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
         $return = array();
362 362
         if (NULL === $model || !method_exists($model, 'toArray')) {
363 363
             $code = 404;
364
-        } else {
364
+        }else {
365 365
             $return = $model->toArray();
366 366
         }
367 367
 
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/base/types/traits/Api/ConnectionTrait.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/base/types/traits/Api/MutationTrait.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -58,21 +58,21 @@  discard block
 block discarded – undo
58 58
         if (count($pks) == 1) {
59 59
             $pks = array_keys($pks);
60 60
             return [
61
-                $tableMap::TABLE_NAME . '.' . $pks[0] => Api::API_MODEL_KEY_FIELD
61
+                $tableMap::TABLE_NAME.'.'.$pks[0] => Api::API_MODEL_KEY_FIELD
62 62
             ];
63 63
         } elseif (count($pks) > 1) {
64 64
             $apiPks = [];
65 65
             $principal = '';
66 66
             $sep = 'CONCAT(';
67 67
             foreach ($pks as $pk) {
68
-                $apiPks[$tableMap::TABLE_NAME . '.' . $pk->getName()] = $pk->getPhpName();
69
-                $principal .= $sep . $tableMap::TABLE_NAME . '.' . $pk->getName();
70
-                $sep = ', "' . Api::API_PK_SEPARATOR . '", ';
68
+                $apiPks[$tableMap::TABLE_NAME.'.'.$pk->getName()] = $pk->getPhpName();
69
+                $principal .= $sep.$tableMap::TABLE_NAME.'.'.$pk->getName();
70
+                $sep = ', "'.Api::API_PK_SEPARATOR.'", ';
71 71
             }
72 72
             $principal .= ')';
73 73
             $apiPks[$principal] = Api::API_MODEL_KEY_FIELD;
74 74
             return $apiPks;
75
-        } else {
75
+        }else {
76 76
             throw new ApiException(_('El modelo de la API no está debidamente mapeado, no hay Primary Key o es compuesta'));
77 77
         }
78 78
     }
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
         $pks = '';
96 96
         $sep = '';
97 97
         foreach ($tableMap->getPrimaryKeys() as $pk) {
98
-            $pks .= $sep . $pk->getFullyQualifiedName();
98
+            $pks .= $sep.$pk->getFullyQualifiedName();
99 99
             $sep = ', "|", ';
100 100
         }
101
-        $this->extraColumns['CONCAT("' . $tableMap->getPhpName() . ' #", ' . $pks . ')'] = Api::API_LIST_NAME_FIELD;
101
+        $this->extraColumns['CONCAT("'.$tableMap->getPhpName().' #", '.$pks.')'] = Api::API_LIST_NAME_FIELD;
102 102
     }
103 103
 
104 104
     /**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             }
121 121
             if (null !== $column) {
122 122
                 $this->extraColumns[$column->getFullyQualifiedName()] = Api::API_LIST_NAME_FIELD;
123
-            } else {
123
+            }else {
124 124
                 $this->addClassListName($tableMap);
125 125
             }
126 126
         }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      * @param ModelCriteria $query
133 133
      * @param string $action
134 134
      */
135
-    private function addExtraColumns(ModelCriteria &$query, $action)
135
+    private function addExtraColumns(ModelCriteria & $query, $action)
136 136
     {
137 137
         if (Api::API_ACTION_LIST === $action) {
138 138
             $this->addDefaultListField();
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
     /**
161 161
      * @param ModelCriteria $query
162 162
      */
163
-    protected function checkI18n(ModelCriteria &$query)
163
+    protected function checkI18n(ModelCriteria & $query)
164 164
     {
165 165
         $model = $this->getModelNamespace();
166
-        $modelI18n = $model . 'I18n';
166
+        $modelI18n = $model.'I18n';
167 167
         if (method_exists($query, 'useI18nQuery')) {
168 168
             $default_language = explode('_', Config::getParam('default.language', 'es_ES'));
169 169
             $query->useI18nQuery(Request::header('X-API-LANG', $default_language[0]));
170
-            $modelI18nTableMapClass = str_replace('\\Models\\', '\\Models\\Map\\', $modelI18n) . 'TableMap';
170
+            $modelI18nTableMapClass = str_replace('\\Models\\', '\\Models\\Map\\', $modelI18n).'TableMap';
171 171
             /** @var TableMap $modelI18nTableMap */
172 172
             $modelI18nTableMap = $modelI18nTableMapClass::getTableMap();
173
-            foreach($modelI18nTableMap->getColumns() as $columnMap) {
174
-                if(!$columnMap->isPrimaryKey()) {
175
-                    $query->withColumn($modelI18nTableMapClass::TABLE_NAME . '.' . $columnMap->getName(), $columnMap->getPhpName());
176
-                } elseif(!$columnMap->isForeignKey()) {
177
-                    $query->withColumn('IFNULL(' . $modelI18nTableMapClass::TABLE_NAME . '.' . $columnMap->getName() . ', "'.Request::header('X-API-LANG', 'es').'")', $columnMap->getPhpName());
173
+            foreach ($modelI18nTableMap->getColumns() as $columnMap) {
174
+                if (!$columnMap->isPrimaryKey()) {
175
+                    $query->withColumn($modelI18nTableMapClass::TABLE_NAME.'.'.$columnMap->getName(), $columnMap->getPhpName());
176
+                } elseif (!$columnMap->isForeignKey()) {
177
+                    $query->withColumn('IFNULL('.$modelI18nTableMapClass::TABLE_NAME.'.'.$columnMap->getName().', "'.Request::header('X-API-LANG', 'es').'")', $columnMap->getPhpName());
178 178
                 }
179 179
             }
180 180
         }
@@ -184,23 +184,23 @@  discard block
 block discarded – undo
184 184
      * @param ActiveRecordInterface $model
185 185
      * @param array $data
186 186
      */
187
-    protected function hydrateModelFromRequest(ActiveRecordInterface &$model, array $data = []) {
187
+    protected function hydrateModelFromRequest(ActiveRecordInterface & $model, array $data = []) {
188 188
         $model->fromArray($data);
189 189
         $tableMap = $this->getTableMap();
190 190
         try {
191
-            $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n');
192
-            if(null !== $relateI18n) {
191
+            $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n');
192
+            if (null !== $relateI18n) {
193 193
                 $i18NTableMap = $relateI18n->getLocalTable();
194
-                foreach($i18NTableMap->getColumns() as $columnMap) {
195
-                    $method = 'set' . $columnMap->getPhpName();
196
-                    if(!($columnMap->isPrimaryKey() && $columnMap->isForeignKey())
194
+                foreach ($i18NTableMap->getColumns() as $columnMap) {
195
+                    $method = 'set'.$columnMap->getPhpName();
196
+                    if (!($columnMap->isPrimaryKey() && $columnMap->isForeignKey())
197 197
                         &&array_key_exists($columnMap->getPhpName(), $data)
198 198
                         && method_exists($model, $method)) {
199 199
                         $model->$method($data[$columnMap->getPhpName()]);
200 200
                     }
201 201
                 }
202 202
             }
203
-        } catch(\Exception $e) {
203
+        }catch (\Exception $e) {
204 204
             Logger::log($e->getMessage(), LOG_WARNING);
205 205
         }
206 206
     }
Please login to merge, or discard this patch.