@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * |
| 179 | 179 | * @param ModelCriteria $query |
| 180 | 180 | */ |
| 181 | - private function addOrders(ModelCriteria &$query) |
|
| 181 | + private function addOrders(ModelCriteria & $query) |
|
| 182 | 182 | { |
| 183 | 183 | $orderAdded = FALSE; |
| 184 | 184 | foreach ($this->order->getOrders() as $field => $direction) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | $orderAdded = TRUE; |
| 187 | 187 | if ($direction === Order::ASC) { |
| 188 | 188 | $query->addAscendingOrderByColumn($field); |
| 189 | - } else { |
|
| 189 | + }else { |
|
| 190 | 190 | $query->addDescendingOrderByColumn($field); |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * |
| 202 | 202 | * @param ModelCriteria $query |
| 203 | 203 | */ |
| 204 | - private function addExtraColumns(ModelCriteria &$query) |
|
| 204 | + private function addExtraColumns(ModelCriteria & $query) |
|
| 205 | 205 | { |
| 206 | 206 | if (!empty($this->extraColumns)) { |
| 207 | 207 | foreach ($this->extraColumns as $expression => $columnName) { |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @param ModelCriteria $query |
| 217 | 217 | */ |
| 218 | - protected function joinTables(ModelCriteria &$query) |
|
| 218 | + protected function joinTables(ModelCriteria & $query) |
|
| 219 | 219 | { |
| 220 | 220 | //TODO for specific implementations |
| 221 | 221 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * |
| 226 | 226 | * @param ModelCriteria $query |
| 227 | 227 | */ |
| 228 | - private function addFilters(ModelCriteria &$query) |
|
| 228 | + private function addFilters(ModelCriteria & $query) |
|
| 229 | 229 | { |
| 230 | 230 | if (count($this->query) > 0) { |
| 231 | 231 | foreach ($this->query as $field => $value) { |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $text = preg_replace('/(\'|\")/', '', $value); |
| 244 | 244 | $text = preg_replace('/\ /', '%', $text); |
| 245 | 245 | $query->filterBy($tableField, '%'.$text.'%', Criteria::LIKE); |
| 246 | - } else { |
|
| 246 | + }else { |
|
| 247 | 247 | $query->filterBy($tableField, $value, Criteria::EQUAL); |
| 248 | 248 | } |
| 249 | 249 | } |
@@ -266,10 +266,10 @@ discard block |
||
| 266 | 266 | list($page, $limit) = $this->extractPagination(); |
| 267 | 267 | if ($limit == -1) { |
| 268 | 268 | $this->list = $query->find($this->con); |
| 269 | - } else { |
|
| 269 | + }else { |
|
| 270 | 270 | $this->list = $query->paginate($page, $limit, $this->con); |
| 271 | 271 | } |
| 272 | - } catch (\Exception $e) { |
|
| 272 | + }catch (\Exception $e) { |
|
| 273 | 273 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $this->joinTables($query); |
| 287 | 287 | $this->addExtraColumns($query); |
| 288 | 288 | $this->model = $query->findPk($pk); |
| 289 | - } catch (\Exception $e) { |
|
| 289 | + }catch (\Exception $e) { |
|
| 290 | 290 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 291 | 291 | } |
| 292 | 292 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | $saved = TRUE; |
| 375 | 375 | $model = $this->model->toArray(); |
| 376 | 376 | } |
| 377 | - } catch (\Exception $e) { |
|
| 377 | + }catch (\Exception $e) { |
|
| 378 | 378 | jpre($e->getMessage(), TRUE); |
| 379 | 379 | Logger::getInstance()->errorLog($e->getMessage()); |
| 380 | 380 | } |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $this->model->delete($this->con); |
| 404 | 404 | $deleted = TRUE; |
| 405 | 405 | } |
| 406 | - } catch (\Exception $e) { |
|
| 406 | + }catch (\Exception $e) { |
|
| 407 | 407 | Logger::getInstance(get_class($this->model))->errorLog($e->getMessage()); |
| 408 | 408 | } |
| 409 | 409 | } |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | private function extractQuery() |
| 449 | 449 | { |
| 450 | - $queryReflector = new \ReflectionClass($this->getModelNamespace() . "Query"); |
|
| 450 | + $queryReflector = new \ReflectionClass($this->getModelNamespace()."Query"); |
|
| 451 | 451 | /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */ |
| 452 | 452 | $query = $queryReflector->getMethod('create')->invoke(NULL); |
| 453 | 453 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | if ($this->con->inTransaction()) { |
| 492 | 492 | if ($status === 200) { |
| 493 | 493 | $this->con->commit(); |
| 494 | - } else { |
|
| 494 | + }else { |
|
| 495 | 495 | $this->con->rollBack(); |
| 496 | 496 | } |
| 497 | 497 | } |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | return $this->render('api.admin.html.twig', array( |
| 536 | 536 | "api" => $this->getApi(), |
| 537 | 537 | "domain" => $this->domain, |
| 538 | - "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('api-' . $this->getApi() . "-pk"), TRUE)), |
|
| 538 | + "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('api-'.$this->getApi()."-pk"), TRUE)), |
|
| 539 | 539 | )); |
| 540 | 540 | } |
| 541 | 541 | |
@@ -557,16 +557,16 @@ discard block |
||
| 557 | 557 | $map = $this->getModelTableMap(); |
| 558 | 558 | /** @var TableMap $fields */ |
| 559 | 559 | $fields = $map::getTableMap(); |
| 560 | - foreach($map::getFieldNames() as $field) { |
|
| 560 | + foreach ($map::getFieldNames() as $field) { |
|
| 561 | 561 | $fDto = new Field($field, _($field)); |
| 562 | 562 | /** @var ColumnMap $mappedColumn */ |
| 563 | 563 | $mappedColumn = $fields->getColumnByPhpName($field); |
| 564 | - if($mappedColumn->isForeignKey()) { |
|
| 564 | + if ($mappedColumn->isForeignKey()) { |
|
| 565 | 565 | $fDto->type = Field::COMBO_TYPE; |
| 566 | 566 | $fDto->required = $mappedColumn->isNotNull(); |
| 567 | 567 | $relatedModel = strtolower($mappedColumn->getRelation()->getForeignTable()->getPhpName()); |
| 568 | 568 | $fDto->entity = $relatedModel; |
| 569 | - $fDto->url = Router::getInstance()->getRoute('api-' . $relatedModel . '-pk'); |
|
| 569 | + $fDto->url = Router::getInstance()->getRoute('api-'.$relatedModel.'-pk'); |
|
| 570 | 570 | } elseif ($mappedColumn->isPrimaryKey()) { |
| 571 | 571 | $fDto->type = Field::HIDDEN_TYPE; |
| 572 | 572 | $fDto->required = false; |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | $return = $this->list->toArray(); |
| 594 | 594 | $total = $this->list->getNbResults(); |
| 595 | 595 | $pages = $this->list->getLastPage(); |
| 596 | - } catch (\Exception $e) { |
|
| 596 | + }catch (\Exception $e) { |
|
| 597 | 597 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 598 | 598 | } |
| 599 | 599 | |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | $return = array(); |
| 613 | 613 | if (NULL === $model && method_exists($model, 'toArray')) { |
| 614 | 614 | $code = 404; |
| 615 | - } else { |
|
| 615 | + }else { |
|
| 616 | 616 | $return = $model->toArray(); |
| 617 | 617 | } |
| 618 | 618 | |