@@ -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 | |
@@ -398,10 +398,10 @@ discard block |
||
398 | 398 | // $filterAndOperator[1] = 'bar' |
399 | 399 | if (isset($filterAndOperator[1])) { |
400 | 400 | if ('list' == $filterAndOperator[1]) { |
401 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
401 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
402 | 402 | } else if ('field_eq' == $filterAndOperator[1]) { |
403 | 403 | $whereCondition = |
404 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
404 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
405 | 405 | $operator['meta'] . '' . |
406 | 406 | $this->entityAlias . '.' . $value |
407 | 407 | ; |
@@ -410,10 +410,10 @@ discard block |
||
410 | 410 | //'Oops! Eccezzione' |
411 | 411 | //); |
412 | 412 | } else { |
413 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
413 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
414 | 414 | } |
415 | 415 | } else { |
416 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
416 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | if ($orCondition['orCondition'] != null) { |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } else { |
442 | 442 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
443 | 443 | if ($isNotARelation) { |
444 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
444 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
445 | 445 | if ($orCondition['orCondition'] != null) { |
446 | 446 | $orCondition['orCondition'] .= ' OR ' . $whereCondition; |
447 | 447 | } else { |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $relationEntityAlias = $this->getRelationEntityAlias(); |
459 | 459 | |
460 | 460 | $embeddedFields = explode('.', $fieldName); |
461 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
461 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
462 | 462 | |
463 | 463 | $salt = ''; |
464 | 464 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -472,9 +472,9 @@ discard block |
||
472 | 472 | } |
473 | 473 | |
474 | 474 | if (isset($filterAndOperator[1]) && 'list' == $filterAndOperator[1]) { |
475 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
475 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
476 | 476 | } else { |
477 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
477 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | if ($orCondition['orCondition'] != null) { |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | |
526 | 526 | if (in_array($fieldName, $this->fields)) { |
527 | 527 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
528 | - $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction); |
|
528 | + $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | if (strstr($sort, '_embedded.')) { |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $fieldName = $this->parser->camelize($embeddedFields[2]); |
537 | 537 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
538 | 538 | |
539 | - $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction); |
|
539 | + $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | } |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | return $this->pageLength; |
625 | 625 | } |
626 | 626 | |
627 | - public function setSelect( $select) : QueryBuilderFactory |
|
627 | + public function setSelect($select) : QueryBuilderFactory |
|
628 | 628 | { |
629 | 629 | $this->select = $select; |
630 | 630 |