@@ -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 | } |
@@ -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 | } |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $this->fields = array_keys($this->getClassMetadata()->fieldMappings); |
| 42 | 42 | |
| 43 | - $entityName = explode('\\', strtolower($this->getEntityName()) ); |
|
| 44 | - $entityName = $entityName[count($entityName)-1]; |
|
| 43 | + $entityName = explode('\\', strtolower($this->getEntityName())); |
|
| 44 | + $entityName = $entityName[count($entityName) - 1]; |
|
| 45 | 45 | $entityAlias = $entityName[0]; |
| 46 | 46 | $this->entityAlias = $entityAlias; |
| 47 | 47 | |
@@ -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 += 1; |
| 127 | 127 | } |
| 128 | 128 | } else { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | foreach ($orFilters as $key => $filterValue) { |
| 174 | 174 | if (is_array($filterValue)) { |
| 175 | 175 | foreach ($filterValue as $keyInternal => $internal) { |
| 176 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
| 176 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
| 177 | 177 | $count += 1; |
| 178 | 178 | } |
| 179 | 179 | } else { |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | foreach ($orFilters as $key => $filter) { |
| 220 | 220 | if (is_array($filter)) { |
| 221 | 221 | foreach ($filter as $keyInternal => $internal) { |
| 222 | - $filterOrCorrected[$keyInternal .'|' . $count] = $internal; |
|
| 222 | + $filterOrCorrected[$keyInternal . '|' . $count] = $internal; |
|
| 223 | 223 | $count += 1; |
| 224 | 224 | } |
| 225 | 225 | } else { |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $pagerAdapter = new DoctrineORMAdapter($queryBuilder); |
| 274 | 274 | |
| 275 | 275 | $query = $pagerAdapter->getQuery(); |
| 276 | - if(null != $this->use_result_cache && $this->use_result_cache){ |
|
| 276 | + if (null != $this->use_result_cache && $this->use_result_cache) { |
|
| 277 | 277 | $query->useResultCache(true, 600); |
| 278 | 278 | } |
| 279 | 279 | |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $params[$itemValue] = $this->queryOptions->get($itemValue); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - if(!isset($this->route_name)){ |
|
| 312 | + if (!isset($this->route_name)) { |
|
| 313 | 313 | $this->route_name = $this->queryOptions->get('_route'); |
| 314 | 314 | } |
| 315 | 315 | |
@@ -338,8 +338,8 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | public function getEntityAlias(string $entityName) : string |
| 340 | 340 | { |
| 341 | - $arrayEntityName = explode('\\', strtolower($entityName) ); |
|
| 342 | - return $arrayEntityName[count($arrayEntityName)-1]; |
|
| 341 | + $arrayEntityName = explode('\\', strtolower($entityName)); |
|
| 342 | + return $arrayEntityName[count($arrayEntityName) - 1]; |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | protected function relationship($queryBuilder) |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | 'path' => __DIR__ . '/../../data/db.sqlite', |
| 15 | 15 | ), |
| 16 | 16 | \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration( |
| 17 | - array(__DIR__."/src"), |
|
| 17 | + array(__DIR__ . "/src"), |
|
| 18 | 18 | true |
| 19 | 19 | )); |
| 20 | 20 | } |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | public function testProvideOneSingleResult() |
| 23 | 23 | { |
| 24 | 24 | $queryBuilderFactory = new QueryBuilderFactory($this->manager); |
| 25 | - $queryBuilderFactory->setFields([ 'id' ]); |
|
| 26 | - $queryBuilderFactory->setAndFilters([ 'id|eq' => 33 ]); |
|
| 25 | + $queryBuilderFactory->setFields(['id']); |
|
| 26 | + $queryBuilderFactory->setAndFilters(['id|eq' => 33]); |
|
| 27 | 27 | $queryBuilderFactory->createQueryBuilder(MySimpleEntity::class, 'e'); |
| 28 | 28 | $queryBuilderFactory->filter(); |
| 29 | 29 | |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | public function testSampleQueryMakedWithQueryBuilderFactory() |
| 40 | 40 | { |
| 41 | 41 | $queryBuilderFactory = new QueryBuilderFactory($this->manager); |
| 42 | - $queryBuilderFactory->setFields([ 'id' ]); |
|
| 43 | - $queryBuilderFactory->setAndFilters([ 'id|eq' => 33 ]); |
|
| 42 | + $queryBuilderFactory->setFields(['id']); |
|
| 43 | + $queryBuilderFactory->setAndFilters(['id|eq' => 33]); |
|
| 44 | 44 | $queryBuilderFactory->createQueryBuilder(MySimpleEntity::class, 'e'); |
| 45 | 45 | $queryBuilderFactory->filter(); |
| 46 | 46 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | public function testOneToManyQueryMakedHandly() |
| 59 | 59 | { |
| 60 | 60 | $queryBuilderFactory = new QueryBuilderFactory($this->manager); |
| 61 | - $queryBuilderFactory->setFields([ 'id' ]); |
|
| 62 | - $queryBuilderFactory->setRel([ 'group' ]); |
|
| 61 | + $queryBuilderFactory->setFields(['id']); |
|
| 62 | + $queryBuilderFactory->setRel(['group']); |
|
| 63 | 63 | $queryBuilderFactory->setAndFilters([ |
| 64 | 64 | '_embedded.group.name|contains|1' => 'ad', |
| 65 | 65 | '_embedded.group.name|contains|2' => 'ns', |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | public function testCanBuildQueriesUsingOrOperator() |
| 114 | 114 | { |
| 115 | 115 | $queryBuilderFactory = new QueryBuilderFactory($this->manager); |
| 116 | - $queryBuilderFactory->setFields([ 'id' ]); |
|
| 117 | - $queryBuilderFactory->setRel([ 'group' ]); |
|
| 116 | + $queryBuilderFactory->setFields(['id']); |
|
| 117 | + $queryBuilderFactory->setRel(['group']); |
|
| 118 | 118 | $queryBuilderFactory->setOrFilters([ |
| 119 | 119 | '_embedded.group.name|contains|1' => 'ad', |
| 120 | 120 | '_embedded.group.name|contains|2' => 'ns', |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $needle = $prevEntityAlias . '_' . $currentEntityAlias; |
| 117 | 117 | |
| 118 | - return ! in_array($needle, $this->joins); |
|
| 118 | + return !in_array($needle, $this->joins); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | private function storeJoin($prevEntityAlias, $currentEntityAlias) |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 275 | 275 | |
| 276 | 276 | $embeddedFields = explode('.', $filterObject->getFieldName()); |
| 277 | - $embeddedFieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 277 | + $embeddedFieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 278 | 278 | |
| 279 | 279 | $salt = '_' . random_int(111, 999); |
| 280 | 280 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 368 | 368 | |
| 369 | 369 | $embeddedFields = explode('.', $filterObject->getFieldName()); |
| 370 | - $embeddableFieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 370 | + $embeddableFieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 371 | 371 | |
| 372 | 372 | $salt = '_' . random_int(111, 999); |
| 373 | 373 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | if ($filterObject->isListType()) { |
| 378 | 378 | $whereCondition .= ' (:field_' . $embeddableFieldName . $salt . ')'; |
| 379 | 379 | } else { |
| 380 | - $whereCondition .=' :field_' . $embeddableFieldName . $salt; |
|
| 380 | + $whereCondition .= ' :field_' . $embeddableFieldName . $salt; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | if (null != $orCondition['orCondition']) { |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | if (in_array($fieldName, $this->fields)) { |
| 430 | 430 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 431 | 431 | $this->ensureQueryBuilderIsDefined(); |
| 432 | - $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction); |
|
| 432 | + $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | if (strstr($sort, '_embedded.')) { |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | $fieldName = $this->parser->camelize($embeddedFields[2]); |
| 441 | 441 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 442 | 442 | |
| 443 | - $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction); |
|
| 443 | + $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | } |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | return $this->pageLength; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - public function setSelect( $select) : QueryBuilderFactory |
|
| 518 | + public function setSelect($select) : QueryBuilderFactory |
|
| 519 | 519 | { |
| 520 | 520 | $this->select = $select; |
| 521 | 521 | |