@@ -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) |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $fieldName = $this->parser->camelize($filtering->getFieldName()); |
211 | 211 | |
212 | 212 | $operator = Operators::getDefaultOperator(); |
213 | - if($filtering->hasOperator()){ |
|
213 | + if ($filtering->hasOperator()) { |
|
214 | 214 | $operator = Operators::get($filtering->getOperator()); |
215 | 215 | $op = Operator::fromFilteringObject($filtering); |
216 | 216 | } else { |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | |
229 | 229 | if ($filtering->hasOperator()) { |
230 | 230 | if ('list' == $filtering->getOperator()) { |
231 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '. |
|
231 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . |
|
232 | 232 | $op->getMeta() |
233 | - .' (:field_'.$fieldName . $salt . ')'; |
|
233 | + .' (:field_' . $fieldName . $salt . ')'; |
|
234 | 234 | } else if ('field_eq' == $filtering->getOperator()) { |
235 | 235 | $whereCondition = |
236 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
236 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
237 | 237 | $op->getMeta() . ' ' . |
238 | 238 | $this->entityAlias . '.' . $value |
239 | 239 | ; |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | $op->getMeta() . ' :field_' . $fieldName . $salt; |
243 | 243 | } |
244 | 244 | } else { |
245 | - $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . |
|
245 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . |
|
246 | 246 | $op->getMeta() . |
247 | - ' ' . ':field_' . $fieldName . $salt; |
|
247 | + ' ' . ':field_' . $fieldName . $salt; |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | $this->qBuilder->andWhere($whereCondition); |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } else { |
266 | 266 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
267 | 267 | if ($isNotARelation) { |
268 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
268 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
269 | 269 | $this->qBuilder->andWhere($whereCondition); |
270 | 270 | } |
271 | 271 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $relationEntityAlias = $this->getRelationEntityAlias(); |
277 | 277 | |
278 | 278 | $embeddedFields = explode('.', $fieldName); |
279 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
279 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
280 | 280 | |
281 | 281 | $salt = ''; |
282 | 282 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -288,11 +288,11 @@ discard block |
||
288 | 288 | if ($filtering->hasOperator() && 'list' == $filtering->getOperator()) { |
289 | 289 | $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . |
290 | 290 | $op->getMeta() . |
291 | - ' (:field_'.$fieldName . $salt . ')'; |
|
291 | + ' (:field_' . $fieldName . $salt . ')'; |
|
292 | 292 | } else { |
293 | 293 | $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . |
294 | 294 | $op->getMeta() . |
295 | - ' :field_'.$fieldName . $salt; |
|
295 | + ' :field_' . $fieldName . $salt; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | $this->qBuilder->andWhere($whereCondition); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $fieldName = $this->parser->camelize($filtering->getFieldName()); |
321 | 321 | |
322 | 322 | $operator = Operators::getDefaultOperator(); |
323 | - if($filtering->hasOperator()) { |
|
323 | + if ($filtering->hasOperator()) { |
|
324 | 324 | $operator = Operators::get($filtering->getOperator()); |
325 | 325 | } |
326 | 326 | |
@@ -337,10 +337,10 @@ discard block |
||
337 | 337 | |
338 | 338 | if ($filtering->hasOperator()) { |
339 | 339 | if ('list' == $filtering->getOperator()) { |
340 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
340 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
341 | 341 | } else if ('field_eq' == $filtering->getOperator()) { |
342 | 342 | $whereCondition = |
343 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
343 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
344 | 344 | $operator['meta'] . '' . |
345 | 345 | $this->entityAlias . '.' . $value |
346 | 346 | ; |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | //'Oops! Eccezzione' |
350 | 350 | //); |
351 | 351 | } else { |
352 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
352 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
353 | 353 | } |
354 | 354 | } else { |
355 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
355 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | if ($orCondition['orCondition'] != null) { |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | } else { |
381 | 381 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
382 | 382 | if ($isNotARelation) { |
383 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
383 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
384 | 384 | if ($orCondition['orCondition'] != null) { |
385 | 385 | $orCondition['orCondition'] .= ' OR ' . $whereCondition; |
386 | 386 | } else { |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | $relationEntityAlias = $this->getRelationEntityAlias(); |
398 | 398 | |
399 | 399 | $embeddedFields = explode('.', $fieldName); |
400 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
400 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
401 | 401 | |
402 | 402 | $salt = ''; |
403 | 403 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -407,9 +407,9 @@ discard block |
||
407 | 407 | } |
408 | 408 | |
409 | 409 | if ($filtering->hasOperator() && 'list' == $filtering->getOperator()) { |
410 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
410 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
411 | 411 | } else { |
412 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
412 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | if ($orCondition['orCondition'] != null) { |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | |
461 | 461 | if (in_array($fieldName, $this->fields)) { |
462 | 462 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
463 | - $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction); |
|
463 | + $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | if (strstr($sort, '_embedded.')) { |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $fieldName = $this->parser->camelize($embeddedFields[2]); |
472 | 472 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
473 | 473 | |
474 | - $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction); |
|
474 | + $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction); |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | } |