@@ -37,7 +37,7 @@ |
||
| 37 | 37 | |
| 38 | 38 | public function getFieldName() |
| 39 | 39 | { |
| 40 | - return $this->properties[FilteringObject::KEY_FIELD_NAME]; |
|
| 40 | + return $this->properties[FilteringObject::KEY_FIELD_NAME]; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function getOperator() |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $this->fields = array_keys($this->getClassMetadata()->fieldMappings); |
| 41 | 41 | |
| 42 | - $entityName = explode('\\', strtolower($this->getEntityName()) ); |
|
| 43 | - $entityName = $entityName[count($entityName)-1]; |
|
| 42 | + $entityName = explode('\\', strtolower($this->getEntityName())); |
|
| 43 | + $entityName = $entityName[count($entityName) - 1]; |
|
| 44 | 44 | $entityAlias = $entityName[0]; |
| 45 | 45 | $this->entityAlias = $entityAlias; |
| 46 | 46 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | foreach ($orFilters as $key => $filter) { |
| 116 | 116 | if (is_array($filter)) { |
| 117 | 117 | foreach ($filter as $keyInternal => $internal) { |
| 118 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
| 118 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
| 119 | 119 | $count = $count + 1; |
| 120 | 120 | } |
| 121 | 121 | } else { |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | foreach ($orFilters as $key => $filter) { |
| 183 | 183 | if (is_array($filter)) { |
| 184 | 184 | foreach ($filter as $keyInternal => $internal) { |
| 185 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
| 185 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
| 186 | 186 | $count = $count + 1; |
| 187 | 187 | } |
| 188 | 188 | } else { |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | foreach ($orFilters as $key => $filter) { |
| 238 | 238 | if (is_array($filter)) { |
| 239 | 239 | foreach ($filter as $keyInternal => $internal) { |
| 240 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
| 240 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
| 241 | 241 | $count = $count + 1; |
| 242 | 242 | } |
| 243 | 243 | } else { |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $pagerAdapter = new DoctrineORMAdapter($queryBuilder); |
| 307 | 307 | |
| 308 | 308 | $query = $pagerAdapter->getQuery(); |
| 309 | - if(isset($this->use_result_cache) and $this->use_result_cache){ |
|
| 309 | + if (isset($this->use_result_cache) and $this->use_result_cache) { |
|
| 310 | 310 | $query->useResultCache(true, 600); |
| 311 | 311 | } |
| 312 | 312 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $params[$itemValue] = $this->queryOptions->get($itemValue); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - if(!isset($this->route_name)){ |
|
| 347 | + if (!isset($this->route_name)) { |
|
| 348 | 348 | $this->route_name = $this->queryOptions->get('_route'); |
| 349 | 349 | } |
| 350 | 350 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | public function noExistsJoin($prevEntityAlias, $currentEntityAlias) |
| 356 | 356 | { |
| 357 | 357 | $needle = $prevEntityAlias . "_" . $currentEntityAlias; |
| 358 | - return ! in_array($needle, $this->joins); |
|
| 358 | + return !in_array($needle, $this->joins); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** @deprecate use QueryBuilderFactory instead */ |
@@ -431,8 +431,8 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | public function getEntityAlias(string $entityName) : string |
| 433 | 433 | { |
| 434 | - $arrayEntityName = explode('\\', strtolower($entityName) ); |
|
| 435 | - $entityAlias = $arrayEntityName[count($arrayEntityName)-1]; |
|
| 434 | + $arrayEntityName = explode('\\', strtolower($entityName)); |
|
| 435 | + $entityAlias = $arrayEntityName[count($arrayEntityName) - 1]; |
|
| 436 | 436 | return $entityAlias; |
| 437 | 437 | } |
| 438 | 438 | |
@@ -461,18 +461,18 @@ discard block |
||
| 461 | 461 | |
| 462 | 462 | $table = $this->getEntityManager()->getClassMetadata($this->getEntityName())->getTableName(); |
| 463 | 463 | |
| 464 | - $sql = 'INSERT INTO '.$table; |
|
| 465 | - $sql .= '('. $list_keys . ') '; |
|
| 466 | - $sql .= "VALUES(". $list_values.") "; |
|
| 464 | + $sql = 'INSERT INTO ' . $table; |
|
| 465 | + $sql .= '(' . $list_keys . ') '; |
|
| 466 | + $sql .= "VALUES(" . $list_values . ") "; |
|
| 467 | 467 | $sql .= 'ON DUPLICATE KEY UPDATE '; |
| 468 | 468 | |
| 469 | 469 | $c = 0; |
| 470 | - foreach($updateFields as $column => $value) { |
|
| 470 | + foreach ($updateFields as $column => $value) { |
|
| 471 | 471 | if ($c > 0) { |
| 472 | 472 | $sql .= ", "; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - $sql .= '`'.$column . "` = '". $value."'"; |
|
| 475 | + $sql .= '`' . $column . "` = '" . $value . "'"; |
|
| 476 | 476 | $c++; |
| 477 | 477 | } |
| 478 | 478 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | $configuration = new Configuration(); |
| 23 | 23 | $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 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $needle = $prevEntityAlias . "_" . $currentEntityAlias; |
| 103 | 103 | |
| 104 | - return ! in_array($needle, $this->joins); |
|
| 104 | + return !in_array($needle, $this->joins); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | private function storeJoin($prevEntityAlias, $currentEntityAlias) |
@@ -222,12 +222,12 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | if ($filtering->hasOperator()) { |
| 224 | 224 | if ('list' == $filtering->getOperator()) { |
| 225 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '. |
|
| 225 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 226 | 226 | $op->getMeta() |
| 227 | - .' (:field_'.$fieldName . $salt . ')'; |
|
| 227 | + .' (:field_' . $fieldName . $salt . ')'; |
|
| 228 | 228 | } else if ('field_eq' == $filtering->getOperator()) { |
| 229 | 229 | $whereCondition = |
| 230 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
| 230 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 231 | 231 | $op->getMeta() . ' ' . |
| 232 | 232 | $this->entityAlias . '.' . $value |
| 233 | 233 | ; |
@@ -236,9 +236,9 @@ discard block |
||
| 236 | 236 | $op->getMeta() . ' :field_' . $fieldName . $salt; |
| 237 | 237 | } |
| 238 | 238 | } else { |
| 239 | - $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 239 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 240 | 240 | $op->getMeta() . |
| 241 | - ' ' . ':field_' . $fieldName . $salt; |
|
| 241 | + ' ' . ':field_' . $fieldName . $salt; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | $this->qBuilder->andWhere($whereCondition); |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | } else { |
| 260 | 260 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
| 261 | 261 | if ($isNotARelation) { |
| 262 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '. |
|
| 262 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 263 | 263 | $op->getMeta() |
| 264 | 264 | .' ' . $this->entityAlias . '.' . $value; |
| 265 | 265 | $this->qBuilder->andWhere($whereCondition); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 273 | 273 | |
| 274 | 274 | $embeddedFields = explode('.', $fieldName); |
| 275 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 275 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 276 | 276 | |
| 277 | 277 | $salt = ''; |
| 278 | 278 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | if ($filtering->hasOperator() && 'list' == $filtering->getOperator()) { |
| 285 | 285 | $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . |
| 286 | 286 | $op->getMeta() . |
| 287 | - ' (:field_'.$fieldName . $salt . ')'; |
|
| 287 | + ' (:field_' . $fieldName . $salt . ')'; |
|
| 288 | 288 | } else { |
| 289 | 289 | $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . |
| 290 | 290 | $op->getMeta() . |
| 291 | - ' :field_'.$fieldName . $salt; |
|
| 291 | + ' :field_' . $fieldName . $salt; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | $this->qBuilder->andWhere($whereCondition); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $fieldName = $this->parser->camelize($filtering->getFieldName()); |
| 317 | 317 | |
| 318 | 318 | $operator = Operators::getDefaultOperator(); |
| 319 | - if($filtering->hasOperator()) { |
|
| 319 | + if ($filtering->hasOperator()) { |
|
| 320 | 320 | $operator = Operators::get($filtering->getOperator()); |
| 321 | 321 | } |
| 322 | 322 | |
@@ -333,10 +333,10 @@ discard block |
||
| 333 | 333 | |
| 334 | 334 | if ($filtering->hasOperator()) { |
| 335 | 335 | if ('list' == $filtering->getOperator()) { |
| 336 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 336 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 337 | 337 | } else if ('field_eq' == $filtering->getOperator()) { |
| 338 | 338 | $whereCondition = |
| 339 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
| 339 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 340 | 340 | $operator['meta'] . '' . |
| 341 | 341 | $this->entityAlias . '.' . $value |
| 342 | 342 | ; |
@@ -345,10 +345,10 @@ discard block |
||
| 345 | 345 | //'Oops! Eccezzione' |
| 346 | 346 | //); |
| 347 | 347 | } else { |
| 348 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 348 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 349 | 349 | } |
| 350 | 350 | } else { |
| 351 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
| 351 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | if ($orCondition['orCondition'] != null) { |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | } else { |
| 377 | 377 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
| 378 | 378 | if ($isNotARelation) { |
| 379 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
| 379 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
| 380 | 380 | if ($orCondition['orCondition'] != null) { |
| 381 | 381 | $orCondition['orCondition'] .= ' OR ' . $whereCondition; |
| 382 | 382 | } else { |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 394 | 394 | |
| 395 | 395 | $embeddedFields = explode('.', $fieldName); |
| 396 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 396 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 397 | 397 | |
| 398 | 398 | $salt = ''; |
| 399 | 399 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -403,9 +403,9 @@ discard block |
||
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | if ($filtering->hasOperator() && 'list' == $filtering->getOperator()) { |
| 406 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 406 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 407 | 407 | } else { |
| 408 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 408 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | if ($orCondition['orCondition'] != null) { |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | |
| 457 | 457 | if (in_array($fieldName, $this->fields)) { |
| 458 | 458 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 459 | - $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction); |
|
| 459 | + $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction); |
|
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | if (strstr($sort, '_embedded.')) { |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | $fieldName = $this->parser->camelize($embeddedFields[2]); |
| 468 | 468 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 469 | 469 | |
| 470 | - $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction); |
|
| 470 | + $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | public static function fromFilteringObject( |
| 46 | 46 | FilteringObject $filteringObject |
| 47 | 47 | ) : Operator { |
| 48 | - if(true === $filteringObject->hasOperator()){ |
|
| 48 | + if (true === $filteringObject->hasOperator()) { |
|
| 49 | 49 | $operatorName = $filteringObject->getOperator(); |
| 50 | 50 | $operator = Operators::get($operatorName); |
| 51 | 51 | |