@@ -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', |
@@ -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) |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | $needle = $prevEntityAlias . "_" . $currentEntityAlias; |
| 108 | 108 | |
| 109 | - return ! in_array($needle, $this->joins); |
|
| 109 | + return !in_array($needle, $this->joins); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | private function storeJoin($prevEntityAlias, $currentEntityAlias) |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 277 | 277 | |
| 278 | 278 | $embeddedFields = explode('.', $filterObject->getFieldName()); |
| 279 | - $embeddedFieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 279 | + $embeddedFieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 280 | 280 | |
| 281 | 281 | $salt = ''; |
| 282 | 282 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -315,14 +315,14 @@ discard block |
||
| 315 | 315 | private function applyFilterOr($filter, $value, $orCondition) |
| 316 | 316 | { |
| 317 | 317 | $whereCondition = null; |
| 318 | - $filterAndOperator = explode('|',$filter); |
|
| 318 | + $filterAndOperator = explode('|', $filter); |
|
| 319 | 319 | $op = Objects\Operator::fromString($filterAndOperator[1]); |
| 320 | 320 | |
| 321 | 321 | $fieldName = $filterAndOperator[0]; |
| 322 | 322 | $fieldName = $this->parser->camelize($fieldName); |
| 323 | 323 | |
| 324 | 324 | $operator = $this->getValueAvailableFilters()[self::DEFAULT_OPERATOR]; |
| 325 | - if(isset($filterAndOperator[1])){ |
|
| 325 | + if (isset($filterAndOperator[1])) { |
|
| 326 | 326 | $operator = $this->getValueAvailableFilters()[$filterAndOperator[1]]; |
| 327 | 327 | } |
| 328 | 328 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | . ' (:field_' . $fieldName . $salt . ')'; |
| 352 | 352 | } else if ($filterObject->isFieldEqualityType()) { |
| 353 | 353 | $whereCondition = |
| 354 | - $this->entityAlias . '.' . $fieldName . ' '. |
|
| 354 | + $this->entityAlias . '.' . $fieldName . ' ' . |
|
| 355 | 355 | $operator['meta'] . '' . |
| 356 | 356 | $this->entityAlias . '.' . $value |
| 357 | 357 | ; |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | . ' :field_' . $fieldName . $salt; |
| 366 | 366 | } |
| 367 | 367 | } else { |
| 368 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' = :field_'.$fieldName . $salt; |
|
| 368 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' = :field_' . $fieldName . $salt; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | if ($orCondition['orCondition'] != null) { |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | } else { |
| 394 | 394 | $isNotARelation = 0 !== strpos($fieldName, 'Embedded.'); |
| 395 | 395 | if ($isNotARelation) { |
| 396 | - $whereCondition = $this->entityAlias.'.'.$fieldName.' '.$operator['meta'].' ' . $this->entityAlias . '.' . $value; |
|
| 396 | + $whereCondition = $this->entityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' ' . $this->entityAlias . '.' . $value; |
|
| 397 | 397 | if ($orCondition['orCondition'] != null) { |
| 398 | 398 | $orCondition['orCondition'] .= ' OR ' . $whereCondition; |
| 399 | 399 | } else { |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | $relationEntityAlias = $this->getRelationEntityAlias(); |
| 411 | 411 | |
| 412 | 412 | $embeddedFields = explode('.', $fieldName); |
| 413 | - $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields)-1]); |
|
| 413 | + $fieldName = $this->parser->camelize($embeddedFields[count($embeddedFields) - 1]); |
|
| 414 | 414 | |
| 415 | 415 | $salt = ''; |
| 416 | 416 | foreach ($this->qBuilder->getParameters() as $parameter) { |
@@ -424,9 +424,9 @@ discard block |
||
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | if (isset($filterAndOperator[1]) && $op->isListOrNlist()) { |
| 427 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' (:field_'.$fieldName . $salt . ')'; |
|
| 427 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' (:field_' . $fieldName . $salt . ')'; |
|
| 428 | 428 | } else { |
| 429 | - $whereCondition = $relationEntityAlias.'.'.$fieldName.' '.$operator['meta'].' :field_'.$fieldName . $salt; |
|
| 429 | + $whereCondition = $relationEntityAlias . '.' . $fieldName . ' ' . $operator['meta'] . ' :field_' . $fieldName . $salt; |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | if ($orCondition['orCondition'] != null) { |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | |
| 478 | 478 | if (in_array($fieldName, $this->fields)) { |
| 479 | 479 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 480 | - $this->qBuilder->addOrderBy($this->entityAlias .'.'. $fieldName, $direction); |
|
| 480 | + $this->qBuilder->addOrderBy($this->entityAlias . '.' . $fieldName, $direction); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | if (strstr($sort, '_embedded.')) { |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | $fieldName = $this->parser->camelize($embeddedFields[2]); |
| 489 | 489 | $direction = ($val === self::DIRECTION_AZ) ? self::DIRECTION_AZ : self::DIRECTION_ZA; |
| 490 | 490 | |
| 491 | - $this->qBuilder->addOrderBy($relationEntityAlias.'.'.$fieldName, $direction); |
|
| 491 | + $this->qBuilder->addOrderBy($relationEntityAlias . '.' . $fieldName, $direction); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | return $this->pageLength; |
| 577 | 577 | } |
| 578 | 578 | |
| 579 | - public function setSelect( $select) : QueryBuilderFactory |
|
| 579 | + public function setSelect($select) : QueryBuilderFactory |
|
| 580 | 580 | { |
| 581 | 581 | $this->select = $select; |
| 582 | 582 | |