@@ -483,7 +483,9 @@ |
||
| 483 | 483 | |
| 484 | 484 | $c = 0; |
| 485 | 485 | foreach($updateFields as $column => $value) { |
| 486 | - if($c>0)$sql .= ", "; |
|
| 486 | + if($c>0) { |
|
| 487 | + $sql .= ", "; |
|
| 488 | + } |
|
| 487 | 489 | $sql .= '`'.$column . "` = '". $value."'"; |
| 488 | 490 | $c++; |
| 489 | 491 | } |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $this->fields = array_keys($this->getClassMetadata()->fieldMappings); |
| 51 | 51 | |
| 52 | - $entityName = explode('\\', strtolower($this->getEntityName()) ); |
|
| 53 | - $entityName = $entityName[count($entityName)-1]; |
|
| 52 | + $entityName = explode('\\', strtolower($this->getEntityName())); |
|
| 53 | + $entityName = $entityName[count($entityName) - 1]; |
|
| 54 | 54 | $entityAlias = $entityName[0]; |
| 55 | 55 | $this->entityAlias = $entityAlias; |
| 56 | 56 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | foreach ($orFilters as $key => $filter) { |
| 133 | 133 | if (is_array($filter)) { |
| 134 | 134 | foreach ($filter as $keyInternal => $internal) { |
| 135 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
| 135 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
| 136 | 136 | $count = $count + 1; |
| 137 | 137 | } |
| 138 | 138 | } else { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | foreach ($orFilters as $key => $filter) { |
| 185 | 185 | if (is_array($filter)) { |
| 186 | 186 | foreach ($filter as $keyInternal => $internal) { |
| 187 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
| 187 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
| 188 | 188 | $count = $count + 1; |
| 189 | 189 | } |
| 190 | 190 | } else { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | foreach ($orFilters as $key => $filter) { |
| 232 | 232 | if (is_array($filter)) { |
| 233 | 233 | foreach ($filter as $keyInternal => $internal) { |
| 234 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
| 234 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
| 235 | 235 | $count = $count + 1; |
| 236 | 236 | } |
| 237 | 237 | } else { |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $pagerAdapter = new DoctrineORMAdapter($queryBuilder); |
| 289 | 289 | |
| 290 | 290 | $query = $pagerAdapter->getQuery(); |
| 291 | - if(isset($this->use_result_cache) and $this->use_result_cache){ |
|
| 291 | + if (isset($this->use_result_cache) and $this->use_result_cache) { |
|
| 292 | 292 | $query->useResultCache(true, 600); |
| 293 | 293 | } |
| 294 | 294 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $params[$itemValue] = $this->queryOptions->get($itemValue); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if(!isset($this->route_name)){ |
|
| 330 | + if (!isset($this->route_name)) { |
|
| 331 | 331 | $this->route_name = $this->queryOptions->get('_route'); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | public function noExistsJoin($prevEntityAlias, $currentEntityAlias) |
| 339 | 339 | { |
| 340 | 340 | $needle = $prevEntityAlias . "_" . $currentEntityAlias; |
| 341 | - return ! in_array($needle, $this->joins); |
|
| 341 | + return !in_array($needle, $this->joins); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** @deprecate use QueryBuilderFatory instead */ |
@@ -446,8 +446,8 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | public function getEntityAlias(string $entityName) : string |
| 448 | 448 | { |
| 449 | - $arrayEntityName = explode('\\', strtolower($entityName) ); |
|
| 450 | - $entityAlias = $arrayEntityName[count($arrayEntityName)-1]; |
|
| 449 | + $arrayEntityName = explode('\\', strtolower($entityName)); |
|
| 450 | + $entityAlias = $arrayEntityName[count($arrayEntityName) - 1]; |
|
| 451 | 451 | return $entityAlias; |
| 452 | 452 | } |
| 453 | 453 | |
@@ -532,16 +532,16 @@ discard block |
||
| 532 | 532 | |
| 533 | 533 | $table = $this->getEntityManager()->getClassMetadata($this->getEntityName())->getTableName(); |
| 534 | 534 | |
| 535 | - $sql = 'INSERT INTO '.$table; |
|
| 536 | - $sql .= '('. $list_keys . ') '; |
|
| 535 | + $sql = 'INSERT INTO ' . $table; |
|
| 536 | + $sql .= '(' . $list_keys . ') '; |
|
| 537 | 537 | //$sql .= 'VALUES("'.implode('","', $insertFields).'") '; |
| 538 | - $sql .= "VALUES(". $list_values.") "; |
|
| 538 | + $sql .= "VALUES(" . $list_values . ") "; |
|
| 539 | 539 | $sql .= 'ON DUPLICATE KEY UPDATE '; |
| 540 | 540 | |
| 541 | 541 | $c = 0; |
| 542 | - foreach($updateFields as $column => $value) { |
|
| 543 | - if($c>0)$sql .= ", "; |
|
| 544 | - $sql .= '`'.$column . "` = '". $value."'"; |
|
| 542 | + foreach ($updateFields as $column => $value) { |
|
| 543 | + if ($c > 0)$sql .= ", "; |
|
| 544 | + $sql .= '`' . $column . "` = '" . $value . "'"; |
|
| 545 | 545 | $c++; |
| 546 | 546 | } |
| 547 | 547 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $configuration = new Configuration(); |
| 23 | 23 | $config = $this->processConfiguration($configuration, $configs); |
| 24 | 24 | |
| 25 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 25 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 26 | 26 | $loader->load('services.yml'); |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | $needle = $prevEntityAlias . "_" . $currentEntityAlias; |
| 154 | 154 | |
| 155 | - return ! in_array($needle, $this->joins); |
|
| 155 | + return !in_array($needle, $this->joins); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | private function storeJoin($prevEntityAlias, $currentEntityAlias) |
@@ -258,13 +258,13 @@ discard block |
||
| 258 | 258 | private function applyFilterAnd($filter, $value) |
| 259 | 259 | { |
| 260 | 260 | $whereCondition = null; |
| 261 | - $filterAndOperator = explode('|',$filter); |
|
| 261 | + $filterAndOperator = explode('|', $filter); |
|
| 262 | 262 | |
| 263 | 263 | $fieldName = $filterAndOperator[0]; |
| 264 | 264 | $fieldName = $this->parser->camelize($fieldName); |
| 265 | 265 | |
| 266 | 266 | $operator = self::$operatorMap[self::DEFAULT_OPERATOR]; |
| 267 | - if(isset($filterAndOperator[1])){ |
|
| 267 | + if (isset($filterAndOperator[1])) { |
|
| 268 | 268 | $operator = self::$operatorMap[$filterAndOperator[1]]; |
| 269 | 269 | } |
| 270 | 270 | |
@@ -284,10 +284,10 @@ discard block |
||
| 284 | 284 | // $filterAndOperator[1] = 'bar' |
| 285 | 285 | if (isset($filterAndOperator[1])) { |
| 286 | 286 | if ('list' == $filterAndOperator[1]) { |
| 287 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 287 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 288 | 288 | } else if ('field_eq' == $filterAndOperator[1]) { |
| 289 | 289 | $whereCondition = |
| 290 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
| 290 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 291 | 291 | $operator['meta'] . '' . |
| 292 | 292 | $this->entityAlias . '.' . $value |
| 293 | 293 | ; |
@@ -296,10 +296,10 @@ discard block |
||
| 296 | 296 | //'Oops! Eccezzione' |
| 297 | 297 | //); |
| 298 | 298 | } else { |
| 299 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 299 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 300 | 300 | } |
| 301 | 301 | } else { |
| 302 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
| 302 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | $this->qBuilder->andWhere($whereCondition); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | } else { |
| 321 | 321 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
| 322 | 322 | if ($isNotARelation) { |
| 323 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
| 323 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
| 324 | 324 | $this->qBuilder->andWhere($whereCondition); |
| 325 | 325 | } |
| 326 | 326 | } |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 334 | 334 | |
| 335 | 335 | $embeddedFields = explode('.', $fieldName); |
| 336 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 336 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 337 | 337 | |
| 338 | 338 | $salt = ''; |
| 339 | 339 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -343,9 +343,9 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | if (isset($filterAndOperator[1]) && 'list' == $filterAndOperator[1]) { |
| 346 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 346 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 347 | 347 | } else { |
| 348 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 348 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | $this->qBuilder->andWhere($whereCondition); |
@@ -368,13 +368,13 @@ discard block |
||
| 368 | 368 | private function applyFilterOr($filter, $value, $orCondition) |
| 369 | 369 | { |
| 370 | 370 | $whereCondition = null; |
| 371 | - $filterAndOperator = explode('|',$filter); |
|
| 371 | + $filterAndOperator = explode('|', $filter); |
|
| 372 | 372 | |
| 373 | 373 | $fieldName = $filterAndOperator[0]; |
| 374 | 374 | $fieldName = $this->parser->camelize($fieldName); |
| 375 | 375 | |
| 376 | 376 | $operator = self::$operatorMap[self::DEFAULT_OPERATOR]; |
| 377 | - if(isset($filterAndOperator[1])){ |
|
| 377 | + if (isset($filterAndOperator[1])) { |
|
| 378 | 378 | $operator = self::$operatorMap[$filterAndOperator[1]]; |
| 379 | 379 | } |
| 380 | 380 | |
@@ -394,10 +394,10 @@ discard block |
||
| 394 | 394 | // $filterAndOperator[1] = 'bar' |
| 395 | 395 | if (isset($filterAndOperator[1])) { |
| 396 | 396 | if ('list' == $filterAndOperator[1]) { |
| 397 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 397 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 398 | 398 | } else if ('field_eq' == $filterAndOperator[1]) { |
| 399 | 399 | $whereCondition = |
| 400 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
| 400 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 401 | 401 | $operator['meta'] . '' . |
| 402 | 402 | $this->entityAlias . '.' . $value |
| 403 | 403 | ; |
@@ -406,10 +406,10 @@ discard block |
||
| 406 | 406 | //'Oops! Eccezzione' |
| 407 | 407 | //); |
| 408 | 408 | } else { |
| 409 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 409 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 410 | 410 | } |
| 411 | 411 | } else { |
| 412 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
| 412 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | if ($orCondition['orCondition'] != null) { |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | } else { |
| 438 | 438 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
| 439 | 439 | if ($isNotARelation) { |
| 440 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
| 440 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
| 441 | 441 | if ($orCondition['orCondition'] != null) { |
| 442 | 442 | $orCondition['orCondition'] .= ' OR ' . $whereCondition; |
| 443 | 443 | } else { |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 455 | 455 | |
| 456 | 456 | $embeddedFields = explode('.', $fieldName); |
| 457 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 457 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 458 | 458 | |
| 459 | 459 | $salt = ''; |
| 460 | 460 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -464,9 +464,9 @@ discard block |
||
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | if (isset($filterAndOperator[1]) && 'list' == $filterAndOperator[1]) { |
| 467 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 467 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 468 | 468 | } else { |
| 469 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 469 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | if ($orCondition['orCondition'] != null) { |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | |
| 518 | 518 | if (in_array($fieldName, $this->fields)) { |
| 519 | 519 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 520 | - $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction); |
|
| 520 | + $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | if (strstr($sort, '_embedded.')) { |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | $fieldName = $this->parser->camelize($embeddedFields[2]); |
| 529 | 529 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 530 | 530 | |
| 531 | - $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction); |
|
| 531 | + $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction); |
|
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | } |