@@ -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 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $needle = $prevEntityAlias . "_" . $currentEntityAlias; |
| 104 | 104 | |
| 105 | - return ! in_array($needle, $this->joins); |
|
| 105 | + return !in_array($needle, $this->joins); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | private function storeJoin($prevEntityAlias, $currentEntityAlias) |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | private function applyFilterAnd($filter, $value) |
| 209 | 209 | { |
| 210 | 210 | $whereCondition = null; |
| 211 | - $filterAndOperator = explode('|',$filter); |
|
| 211 | + $filterAndOperator = explode('|', $filter); |
|
| 212 | 212 | |
| 213 | 213 | $fieldName = $filterAndOperator[0]; |
| 214 | 214 | $fieldName = $this->parser->camelize($fieldName); |
| 215 | 215 | |
| 216 | 216 | $operator = $this->getAvailableFilters()[self::DEFAULT_OPERATOR]; |
| 217 | - if(isset($filterAndOperator[1])){ |
|
| 217 | + if (isset($filterAndOperator[1])) { |
|
| 218 | 218 | $operator = $this->getAvailableFilters()[$filterAndOperator[1]]; |
| 219 | 219 | } |
| 220 | 220 | |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | // $filterAndOperator[1] = 'bar' |
| 235 | 235 | if (isset($filterAndOperator[1])) { |
| 236 | 236 | if ('list' == $filterAndOperator[1]) { |
| 237 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 237 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 238 | 238 | } else if ('field_eq' == $filterAndOperator[1]) { |
| 239 | 239 | $whereCondition = |
| 240 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
| 240 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 241 | 241 | $operator['meta'] . '' . |
| 242 | 242 | $this->entityAlias . '.' . $value |
| 243 | 243 | ; |
@@ -246,10 +246,10 @@ discard block |
||
| 246 | 246 | //'Oops! Eccezzione' |
| 247 | 247 | //); |
| 248 | 248 | } else { |
| 249 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 249 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 250 | 250 | } |
| 251 | 251 | } else { |
| 252 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
| 252 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | $this->qBuilder->andWhere($whereCondition); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | } else { |
| 271 | 271 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
| 272 | 272 | if ($isNotARelation) { |
| 273 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
| 273 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
| 274 | 274 | $this->qBuilder->andWhere($whereCondition); |
| 275 | 275 | } |
| 276 | 276 | } |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 284 | 284 | |
| 285 | 285 | $embeddedFields = explode('.', $fieldName); |
| 286 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 286 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 287 | 287 | |
| 288 | 288 | $salt = ''; |
| 289 | 289 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -293,9 +293,9 @@ discard block |
||
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | if (isset($filterAndOperator[1]) && 'list' == $filterAndOperator[1]) { |
| 296 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 296 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 297 | 297 | } else { |
| 298 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 298 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | $this->qBuilder->andWhere($whereCondition); |
@@ -318,13 +318,13 @@ discard block |
||
| 318 | 318 | private function applyFilterOr($filter, $value, $orCondition) |
| 319 | 319 | { |
| 320 | 320 | $whereCondition = null; |
| 321 | - $filterAndOperator = explode('|',$filter); |
|
| 321 | + $filterAndOperator = explode('|', $filter); |
|
| 322 | 322 | |
| 323 | 323 | $fieldName = $filterAndOperator[0]; |
| 324 | 324 | $fieldName = $this->parser->camelize($fieldName); |
| 325 | 325 | |
| 326 | 326 | $operator = $this->getAvailableFilters()[self::DEFAULT_OPERATOR]; |
| 327 | - if(isset($filterAndOperator[1])){ |
|
| 327 | + if (isset($filterAndOperator[1])) { |
|
| 328 | 328 | $operator = $this->getAvailableFilters()[$filterAndOperator[1]]; |
| 329 | 329 | } |
| 330 | 330 | |
@@ -348,10 +348,10 @@ discard block |
||
| 348 | 348 | // $filterAndOperator[1] = 'bar' |
| 349 | 349 | if (isset($filterAndOperator[1])) { |
| 350 | 350 | if ('list' == $filterAndOperator[1]) { |
| 351 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 351 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 352 | 352 | } else if ('field_eq' == $filterAndOperator[1]) { |
| 353 | 353 | $whereCondition = |
| 354 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
| 354 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 355 | 355 | $operator['meta'] . '' . |
| 356 | 356 | $this->entityAlias . '.' . $value |
| 357 | 357 | ; |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | //'Oops! Eccezzione' |
| 361 | 361 | //); |
| 362 | 362 | } else { |
| 363 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 363 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 364 | 364 | } |
| 365 | 365 | } else { |
| 366 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
| 366 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | if ($orCondition['orCondition'] != null) { |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | } else { |
| 392 | 392 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
| 393 | 393 | if ($isNotARelation) { |
| 394 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
| 394 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
| 395 | 395 | if ($orCondition['orCondition'] != null) { |
| 396 | 396 | $orCondition['orCondition'] .= ' OR ' . $whereCondition; |
| 397 | 397 | } else { |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 409 | 409 | |
| 410 | 410 | $embeddedFields = explode('.', $fieldName); |
| 411 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 411 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 412 | 412 | |
| 413 | 413 | $salt = ''; |
| 414 | 414 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -422,9 +422,9 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | if (isset($filterAndOperator[1]) && 'list' == $filterAndOperator[1]) { |
| 425 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 425 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 426 | 426 | } else { |
| 427 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 427 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | if ($orCondition['orCondition'] != null) { |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | |
| 476 | 476 | if (in_array($fieldName, $this->fields)) { |
| 477 | 477 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 478 | - $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction); |
|
| 478 | + $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | if (strstr($sort, '_embedded.')) { |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | $fieldName = $this->parser->camelize($embeddedFields[2]); |
| 487 | 487 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 488 | 488 | |
| 489 | - $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction); |
|
| 489 | + $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | return $this->pageLength; |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | - public function setSelect( $select) : QueryBuilderFactory |
|
| 577 | + public function setSelect($select) : QueryBuilderFactory |
|
| 578 | 578 | { |
| 579 | 579 | $this->select = $select; |
| 580 | 580 | |