@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | $this->fields = array_keys($this->getClassMetadata()->fieldMappings); |
45 | 45 | |
46 | - $entityName = explode('\\', strtolower($this->getEntityName()) ); |
|
47 | - $entityName = $entityName[count($entityName)-1]; |
|
46 | + $entityName = explode('\\', strtolower($this->getEntityName())); |
|
47 | + $entityName = $entityName[count($entityName) - 1]; |
|
48 | 48 | //$entityAlias = $entityName[0]; |
49 | 49 | $this->entityAlias = $entityName; |
50 | 50 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | foreach ($orFilters as $key => $filter) { |
129 | 129 | if (is_array($filter)) { |
130 | 130 | foreach ($filter as $keyInternal => $internal) { |
131 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
131 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
132 | 132 | $count = $count + 1; |
133 | 133 | } |
134 | 134 | } else { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | foreach ($orFilters as $key => $filter) { |
181 | 181 | if (is_array($filter)) { |
182 | 182 | foreach ($filter as $keyInternal => $internal) { |
183 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
183 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
184 | 184 | $count = $count + 1; |
185 | 185 | } |
186 | 186 | } else { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | foreach ($orFilters as $key => $filter) { |
228 | 228 | if (is_array($filter)) { |
229 | 229 | foreach ($filter as $keyInternal => $internal) { |
230 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
230 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
231 | 231 | $count = $count + 1; |
232 | 232 | } |
233 | 233 | } else { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | $pagerAdapter = new DoctrineORMAdapter($queryBuilder); |
300 | 300 | |
301 | 301 | $query = $pagerAdapter->getQuery(); |
302 | - if(isset($this->use_result_cache) and $this->use_result_cache){ |
|
302 | + if (isset($this->use_result_cache) and $this->use_result_cache) { |
|
303 | 303 | $query->useResultCache(true, 600); |
304 | 304 | } |
305 | 305 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | $params[$itemValue] = $this->queryOptions->get($itemValue); |
341 | 341 | } |
342 | 342 | |
343 | - if(!isset($this->route_name)){ |
|
343 | + if (!isset($this->route_name)) { |
|
344 | 344 | $this->route_name = $this->queryOptions->get('_route'); |
345 | 345 | } |
346 | 346 | |
@@ -369,8 +369,8 @@ discard block |
||
369 | 369 | |
370 | 370 | public function getEntityAlias(string $entityName) : string |
371 | 371 | { |
372 | - $arrayEntityName = explode('\\', strtolower($entityName) ); |
|
373 | - return $arrayEntityName[count($arrayEntityName)-1]; |
|
372 | + $arrayEntityName = explode('\\', strtolower($entityName)); |
|
373 | + return $arrayEntityName[count($arrayEntityName) - 1]; |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | protected function relationship($queryBuilder) |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | //$this->entityAliases[$relationEntityAlias]['alias'] = $prevEntityAlias . "_" . $relationEntityAlias; |
113 | 113 | |
114 | - return ! in_array($needle, $this->joins); |
|
114 | + return !in_array($needle, $this->joins); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | private function storeJoin($relationEntityAlias, $relation, $association) |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | private function applyFilterAnd($filter, $value) |
223 | 223 | { |
224 | 224 | $whereCondition = null; |
225 | - $filterAndOperator = explode('|',$filter); |
|
225 | + $filterAndOperator = explode('|', $filter); |
|
226 | 226 | |
227 | 227 | $fieldName = $filterAndOperator[0]; |
228 | 228 | $fieldName = $this->parser->camelize($fieldName); |
229 | 229 | |
230 | 230 | $operator = $this->getValueAvailableFilters()[self::DEFAULT_OPERATOR]; |
231 | - if(isset($filterAndOperator[1])){ |
|
231 | + if (isset($filterAndOperator[1])) { |
|
232 | 232 | $operator = $this->getValueAvailableFilters()[$filterAndOperator[1]]; |
233 | 233 | } |
234 | 234 | |
@@ -248,10 +248,10 @@ discard block |
||
248 | 248 | // $filterAndOperator[1] = 'bar' |
249 | 249 | if (isset($filterAndOperator[1])) { |
250 | 250 | if ('list' == $filterAndOperator[1]) { |
251 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
251 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
252 | 252 | } else if ('field_eq' == $filterAndOperator[1]) { |
253 | 253 | $whereCondition = |
254 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
254 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
255 | 255 | $operator['meta'] . '' . |
256 | 256 | $this->entityAlias . '.' . $value |
257 | 257 | ; |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | //'Oops! Eccezzione' |
261 | 261 | //); |
262 | 262 | } else { |
263 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
263 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
264 | 264 | } |
265 | 265 | } else { |
266 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
266 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | $this->qBuilder->andWhere($whereCondition); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | } else { |
285 | 285 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
286 | 286 | if ($isNotARelation) { |
287 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
287 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
288 | 288 | $this->qBuilder->andWhere($whereCondition); |
289 | 289 | } |
290 | 290 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $relationEntityAlias = $this->getRelationEntityAlias(); |
298 | 298 | |
299 | 299 | $embeddedFields = explode('.', $fieldName); |
300 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
300 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
301 | 301 | |
302 | 302 | $salt = ''; |
303 | 303 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -307,9 +307,9 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | if (isset($filterAndOperator[1]) && 'list' == $filterAndOperator[1]) { |
310 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
310 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
311 | 311 | } else { |
312 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
312 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | $this->qBuilder->andWhere($whereCondition); |
@@ -332,13 +332,13 @@ discard block |
||
332 | 332 | private function applyFilterOr($filter, $value, $orCondition) |
333 | 333 | { |
334 | 334 | $whereCondition = null; |
335 | - $filterAndOperator = explode('|',$filter); |
|
335 | + $filterAndOperator = explode('|', $filter); |
|
336 | 336 | |
337 | 337 | $fieldName = $filterAndOperator[0]; |
338 | 338 | $fieldName = $this->parser->camelize($fieldName); |
339 | 339 | |
340 | 340 | $operator = $this->getValueAvailableFilters()[self::DEFAULT_OPERATOR]; |
341 | - if(isset($filterAndOperator[1])){ |
|
341 | + if (isset($filterAndOperator[1])) { |
|
342 | 342 | $operator = $this->getValueAvailableFilters()[$filterAndOperator[1]]; |
343 | 343 | } |
344 | 344 | |
@@ -362,10 +362,10 @@ discard block |
||
362 | 362 | // $filterAndOperator[1] = 'bar' |
363 | 363 | if (isset($filterAndOperator[1])) { |
364 | 364 | if ('list' == $filterAndOperator[1]) { |
365 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
365 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
366 | 366 | } else if ('field_eq' == $filterAndOperator[1]) { |
367 | 367 | $whereCondition = |
368 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
368 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
369 | 369 | $operator['meta'] . '' . |
370 | 370 | $this->entityAlias . '.' . $value |
371 | 371 | ; |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | //'Oops! Eccezzione' |
375 | 375 | //); |
376 | 376 | } else { |
377 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
377 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
378 | 378 | } |
379 | 379 | } else { |
380 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
380 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | if ($orCondition['orCondition'] != null) { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | } else { |
406 | 406 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
407 | 407 | if ($isNotARelation) { |
408 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
408 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
409 | 409 | if ($orCondition['orCondition'] != null) { |
410 | 410 | $orCondition['orCondition'] .= ' OR ' . $whereCondition; |
411 | 411 | } else { |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $relationEntityAlias = $this->getRelationEntityAlias(); |
423 | 423 | |
424 | 424 | $embeddedFields = explode('.', $fieldName); |
425 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
425 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
426 | 426 | |
427 | 427 | $salt = ''; |
428 | 428 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | } |
437 | 437 | |
438 | 438 | if (isset($filterAndOperator[1]) && 'list' == $filterAndOperator[1]) { |
439 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
439 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
440 | 440 | } else { |
441 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
441 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | if ($orCondition['orCondition'] != null) { |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | |
490 | 490 | if (in_array($fieldName, $this->fields)) { |
491 | 491 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
492 | - $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction); |
|
492 | + $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | if (strstr($sort, '_embedded.')) { |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | $fieldName = $this->parser->camelize($embeddedFields[2]); |
501 | 501 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
502 | 502 | |
503 | - $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction); |
|
503 | + $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | } |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | return $this->pageLength; |
589 | 589 | } |
590 | 590 | |
591 | - public function setSelect( $select) : QueryBuilderFactory |
|
591 | + public function setSelect($select) : QueryBuilderFactory |
|
592 | 592 | { |
593 | 593 | $this->select = $select; |
594 | 594 |