@@ -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 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | 'path' => __DIR__ . '/../../data/db.sqlite', |
16 | 16 | ), |
17 | 17 | \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration( |
18 | - array(__DIR__."/src"), |
|
18 | + array(__DIR__ . "/src"), |
|
19 | 19 | true |
20 | 20 | )); |
21 | 21 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | public function testProvideOneSingleResult() |
24 | 24 | { |
25 | 25 | $queryBuilderFactory = new QueryBuilderFactory($this->manager); |
26 | - $queryBuilderFactory->setFields([ 'id' ]); |
|
27 | - $queryBuilderFactory->setFilters([ 'id|eq' => 33 ]); |
|
26 | + $queryBuilderFactory->setFields(['id']); |
|
27 | + $queryBuilderFactory->setFilters(['id|eq' => 33]); |
|
28 | 28 | $queryBuilderFactory->createQueryBuilder(MySimpleEntity::class, 'e'); |
29 | 29 | $queryBuilderFactory->filter(); |
30 | 30 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | public function testSampleQueryMakedWithQueryBuilderFactory() |
41 | 41 | { |
42 | 42 | $queryBuilderFactory = new QueryBuilderFactory($this->manager); |
43 | - $queryBuilderFactory->setFields([ 'id' ]); |
|
44 | - $queryBuilderFactory->setFilters([ 'id|eq' => 33 ]); |
|
43 | + $queryBuilderFactory->setFields(['id']); |
|
44 | + $queryBuilderFactory->setFilters(['id|eq' => 33]); |
|
45 | 45 | $queryBuilderFactory->createQueryBuilder(MySimpleEntity::class, 'e'); |
46 | 46 | $queryBuilderFactory->filter(); |
47 | 47 | |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | public function testOneToManyQueryMakedHandly() |
60 | 60 | { |
61 | 61 | $queryBuilderFactory = new QueryBuilderFactory($this->manager); |
62 | - $queryBuilderFactory->setFields([ 'id' ]); |
|
63 | - $queryBuilderFactory->setRel([ 'group' ]); |
|
62 | + $queryBuilderFactory->setFields(['id']); |
|
63 | + $queryBuilderFactory->setRel(['group']); |
|
64 | 64 | $queryBuilderFactory->setFilters([ |
65 | 65 | '_embedded.group.name|contains|1' => 'ad', |
66 | 66 | '_embedded.group.name|contains|2' => 'ns', |
@@ -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 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | foreach ($orFilters as $key => $filter) { |
123 | 123 | if (is_array($filter)) { |
124 | 124 | foreach ($filter as $keyInternal => $internal) { |
125 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
125 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
126 | 126 | $count = $count + 1; |
127 | 127 | } |
128 | 128 | } else { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | foreach ($orFilters as $key => $filter) { |
175 | 175 | if (is_array($filter)) { |
176 | 176 | foreach ($filter as $keyInternal => $internal) { |
177 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
177 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
178 | 178 | $count = $count + 1; |
179 | 179 | } |
180 | 180 | } else { |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | foreach ($orFilters as $key => $filter) { |
222 | 222 | if (is_array($filter)) { |
223 | 223 | foreach ($filter as $keyInternal => $internal) { |
224 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
224 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
225 | 225 | $count = $count + 1; |
226 | 226 | } |
227 | 227 | } else { |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $pagerAdapter = new DoctrineORMAdapter($queryBuilder); |
279 | 279 | |
280 | 280 | $query = $pagerAdapter->getQuery(); |
281 | - if(isset($this->use_result_cache) and $this->use_result_cache){ |
|
281 | + if (isset($this->use_result_cache) and $this->use_result_cache) { |
|
282 | 282 | $query->useResultCache(true, 600); |
283 | 283 | } |
284 | 284 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $params[$itemValue] = $this->queryOptions->get($itemValue); |
318 | 318 | } |
319 | 319 | |
320 | - if(!isset($this->route_name)){ |
|
320 | + if (!isset($this->route_name)) { |
|
321 | 321 | $this->route_name = $this->queryOptions->get('_route'); |
322 | 322 | } |
323 | 323 | |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | |
347 | 347 | public function getEntityAlias(string $entityName) : string |
348 | 348 | { |
349 | - $arrayEntityName = explode('\\', strtolower($entityName) ); |
|
350 | - return $arrayEntityName[count($arrayEntityName)-1]; |
|
349 | + $arrayEntityName = explode('\\', strtolower($entityName)); |
|
350 | + return $arrayEntityName[count($arrayEntityName) - 1]; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | protected function relationship($queryBuilder) |
@@ -47,7 +47,7 @@ |
||
47 | 47 | ->getMock(); |
48 | 48 | $this->factory->expects($this->once()) |
49 | 49 | ->method('getAllMetadata') |
50 | - ->will($this->returnValue(function () { |
|
50 | + ->will($this->returnValue(function() { |
|
51 | 51 | return [ |
52 | 52 | 'SomeBundle\Entity\ParentEntity' => [ |
53 | 53 | 'relations' => [ |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $this->mapper = $mapper; |
47 | 47 | $this->logger = $logger; |
48 | 48 | |
49 | - $this->appendRootEntityToSubject = function($subject, $rootEntity) { |
|
49 | + $this->appendRootEntityToSubject = function($subject, $rootEntity) { |
|
50 | 50 | $subject[] = $rootEntity; |
51 | 51 | return $subject; |
52 | 52 | }; |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $entities = $this->getEntitiesPath(); |
277 | 277 | $lastEntityFound = end($entities); |
278 | 278 | $this->removeStep($lastEntityFound); |
279 | - } catch(\Mado\QueryBundle\Component\Meta\Exceptions\UnexpectedValueException $e) { |
|
279 | + } catch (\Mado\QueryBundle\Component\Meta\Exceptions\UnexpectedValueException $e) { |
|
280 | 280 | return; |
281 | 281 | } |
282 | 282 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $operators = Dictionary::getOperators(); |
48 | 48 | |
49 | - if(isset($explodedRawFilter[1])){ |
|
49 | + if (isset($explodedRawFilter[1])) { |
|
50 | 50 | $rawOperator = $operators[$explodedRawFilter[1]]; |
51 | 51 | } else { |
52 | 52 | $rawOperator = $operators[QueryBuilderFactory::DEFAULT_OPERATOR]; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | public static function fromRawFilter(string $filter) : Filter |
86 | 86 | { |
87 | - $explodedRawFilter = explode('|',$filter); |
|
87 | + $explodedRawFilter = explode('|', $filter); |
|
88 | 88 | |
89 | 89 | if (!isset($explodedRawFilter[1])) { |
90 | 90 | $explodedRawFilter[1] = 'eq'; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $needle = $prevEntityAlias . "_" . $currentEntityAlias; |
110 | 110 | |
111 | - return ! in_array($needle, $this->joins); |
|
111 | + return !in_array($needle, $this->joins); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | private function storeJoin($prevEntityAlias, $currentEntityAlias) |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | . ' (:field_' . $fieldName . $salt . ')'; |
248 | 248 | } else if ('field_eq' == $explodedQueryStringRawFilter[1]) { |
249 | 249 | $whereCondition = |
250 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
250 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
251 | 251 | $operator['meta'] . '' . |
252 | 252 | $this->entityAlias . '.' . $value; |
253 | 253 | //} else { |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $relationEntityAlias = $this->getRelationEntityAlias(); |
297 | 297 | |
298 | 298 | $embeddedFields = explode('.', $filter->getFieldName()); |
299 | - $embeddedFieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
299 | + $embeddedFieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
300 | 300 | |
301 | 301 | $salt = ''; |
302 | 302 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -334,14 +334,14 @@ discard block |
||
334 | 334 | private function applyFilterOr($filter, $value, $orCondition) |
335 | 335 | { |
336 | 336 | $whereCondition = null; |
337 | - $explodedQueryStringRawFilter = explode('|',$filter); |
|
337 | + $explodedQueryStringRawFilter = explode('|', $filter); |
|
338 | 338 | $op = Operator::fromString($explodedQueryStringRawFilter[1]); |
339 | 339 | |
340 | 340 | $fieldName = $explodedQueryStringRawFilter[0]; |
341 | 341 | $fieldName = $this->parser->camelize($fieldName); |
342 | 342 | |
343 | 343 | $operator = $this->getValueAvailableFilters()[self::DEFAULT_OPERATOR]; |
344 | - if(isset($explodedQueryStringRawFilter[1])){ |
|
344 | + if (isset($explodedQueryStringRawFilter[1])) { |
|
345 | 345 | $operator = $this->getValueAvailableFilters()[$explodedQueryStringRawFilter[1]]; |
346 | 346 | } |
347 | 347 | |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | . ' (:field_' . $fieldName . $salt . ')'; |
371 | 371 | } else if ('field_eq' == $explodedQueryStringRawFilter[1]) { |
372 | 372 | $whereCondition = |
373 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
373 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
374 | 374 | $operator['meta'] . '' . |
375 | 375 | $this->entityAlias . '.' . $value |
376 | 376 | ; |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | } else { |
387 | 387 | $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' |
388 | 388 | . '=' |
389 | - . ' :field_'.$fieldName . $salt; |
|
389 | + . ' :field_' . $fieldName . $salt; |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | if ($orCondition['orCondition'] != null) { |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $relationEntityAlias = $this->getRelationEntityAlias(); |
436 | 436 | |
437 | 437 | $embeddedFields = explode('.', $fieldName); |
438 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
438 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
439 | 439 | |
440 | 440 | $salt = ''; |
441 | 441 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | if (in_array($fieldName, $this->fields)) { |
510 | 510 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
511 | - $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction); |
|
511 | + $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | if (strstr($sort, '_embedded.')) { |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | $fieldName = $this->parser->camelize($embeddedFields[2]); |
520 | 520 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
521 | 521 | |
522 | - $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction); |
|
522 | + $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | } |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | return $this->pageLength; |
608 | 608 | } |
609 | 609 | |
610 | - public function setSelect( $select) : QueryBuilderFactory |
|
610 | + public function setSelect($select) : QueryBuilderFactory |
|
611 | 611 | { |
612 | 612 | $this->select = $select; |
613 | 613 |