|
@@ -291,11 +291,11 @@ discard block |
|
|
block discarded – undo |
291
|
291
|
*/ |
292
|
292
|
public function getSQLTableAlias($tableName, $dqlAlias = '') |
293
|
293
|
{ |
294
|
|
- $tableName .= ($dqlAlias) ? '@[' . $dqlAlias . ']' : ''; |
|
294
|
+ $tableName .= ($dqlAlias) ? '@['.$dqlAlias.']' : ''; |
295
|
295
|
|
296
|
296
|
if ( ! isset($this->tableAliasMap[$tableName])) { |
297
|
297
|
$this->tableAliasMap[$tableName] = (preg_match('/[a-z]/i', $tableName[0]) ? strtolower($tableName[0]) : 't') |
298
|
|
- . $this->tableAliasCounter++ . '_'; |
|
298
|
+ . $this->tableAliasCounter++.'_'; |
299
|
299
|
} |
300
|
300
|
|
301
|
301
|
return $this->tableAliasMap[$tableName]; |
|
@@ -313,7 +313,7 @@ discard block |
|
|
block discarded – undo |
313
|
313
|
*/ |
314
|
314
|
public function setSQLTableAlias($tableName, $alias, $dqlAlias = '') |
315
|
315
|
{ |
316
|
|
- $tableName .= ($dqlAlias) ? '@[' . $dqlAlias . ']' : ''; |
|
316
|
+ $tableName .= ($dqlAlias) ? '@['.$dqlAlias.']' : ''; |
317
|
317
|
|
318
|
318
|
$this->tableAliasMap[$tableName] = $alias; |
319
|
319
|
|
|
@@ -354,12 +354,12 @@ discard block |
|
|
block discarded – undo |
354
|
354
|
|
355
|
355
|
// If this is a joined association we must use left joins to preserve the correct result. |
356
|
356
|
$sql .= isset($this->queryComponents[$dqlAlias]['relation']) ? ' LEFT ' : ' INNER '; |
357
|
|
- $sql .= 'JOIN ' . $this->quoteStrategy->getTableName($parentClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
357
|
+ $sql .= 'JOIN '.$this->quoteStrategy->getTableName($parentClass, $this->platform).' '.$tableAlias.' ON '; |
358
|
358
|
|
359
|
359
|
$sqlParts = []; |
360
|
360
|
|
361
|
361
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($class, $this->platform) as $columnName) { |
362
|
|
- $sqlParts[] = $baseTableAlias . '.' . $columnName . ' = ' . $tableAlias . '.' . $columnName; |
|
362
|
+ $sqlParts[] = $baseTableAlias.'.'.$columnName.' = '.$tableAlias.'.'.$columnName; |
363
|
363
|
} |
364
|
364
|
|
365
|
365
|
// Add filters on the root class |
|
@@ -380,12 +380,12 @@ discard block |
|
|
block discarded – undo |
380
|
380
|
$subClass = $this->em->getClassMetadata($subClassName); |
381
|
381
|
$tableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias); |
382
|
382
|
|
383
|
|
- $sql .= ' LEFT JOIN ' . $this->quoteStrategy->getTableName($subClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
383
|
+ $sql .= ' LEFT JOIN '.$this->quoteStrategy->getTableName($subClass, $this->platform).' '.$tableAlias.' ON '; |
384
|
384
|
|
385
|
385
|
$sqlParts = []; |
386
|
386
|
|
387
|
387
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($subClass, $this->platform) as $columnName) { |
388
|
|
- $sqlParts[] = $baseTableAlias . '.' . $columnName . ' = ' . $tableAlias . '.' . $columnName; |
|
388
|
+ $sqlParts[] = $baseTableAlias.'.'.$columnName.' = '.$tableAlias.'.'.$columnName; |
389
|
389
|
} |
390
|
390
|
|
391
|
391
|
$sql .= implode(' AND ', $sqlParts); |
|
@@ -417,7 +417,7 @@ discard block |
|
|
block discarded – undo |
417
|
417
|
? $persister->getOwningTable($fieldName) |
418
|
418
|
: $qComp['metadata']->getTableName(); |
419
|
419
|
|
420
|
|
- $orderedColumn = $this->getSQLTableAlias($tableName, $dqlAlias) . '.' . $columnName; |
|
420
|
+ $orderedColumn = $this->getSQLTableAlias($tableName, $dqlAlias).'.'.$columnName; |
421
|
421
|
|
422
|
422
|
// OrderByClause should replace an ordered relation. see - DDC-2475 |
423
|
423
|
if (isset($this->orderedColumnsMap[$orderedColumn])) { |
|
@@ -425,7 +425,7 @@ discard block |
|
|
block discarded – undo |
425
|
425
|
} |
426
|
426
|
|
427
|
427
|
$this->orderedColumnsMap[$orderedColumn] = $orientation; |
428
|
|
- $orderedColumns[] = $orderedColumn . ' ' . $orientation; |
|
428
|
+ $orderedColumns[] = $orderedColumn.' '.$orientation; |
429
|
429
|
} |
430
|
430
|
} |
431
|
431
|
|
|
@@ -460,15 +460,15 @@ discard block |
|
|
block discarded – undo |
460
|
460
|
} |
461
|
461
|
|
462
|
462
|
$sqlTableAlias = ($this->useSqlTableAliases) |
463
|
|
- ? $this->getSQLTableAlias($class->getTableName(), $dqlAlias) . '.' |
|
463
|
+ ? $this->getSQLTableAlias($class->getTableName(), $dqlAlias).'.' |
464
|
464
|
: ''; |
465
|
465
|
|
466
|
|
- $sqlParts[] = $sqlTableAlias . $class->discriminatorColumn['name'] . ' IN (' . implode(', ', $values) . ')'; |
|
466
|
+ $sqlParts[] = $sqlTableAlias.$class->discriminatorColumn['name'].' IN ('.implode(', ', $values).')'; |
467
|
467
|
} |
468
|
468
|
|
469
|
469
|
$sql = implode(' AND ', $sqlParts); |
470
|
470
|
|
471
|
|
- return (count($sqlParts) > 1) ? '(' . $sql . ')' : $sql; |
|
471
|
+ return (count($sqlParts) > 1) ? '('.$sql.')' : $sql; |
472
|
472
|
} |
473
|
473
|
|
474
|
474
|
/** |
|
@@ -481,11 +481,11 @@ discard block |
|
|
block discarded – undo |
481
|
481
|
*/ |
482
|
482
|
private function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias) |
483
|
483
|
{ |
484
|
|
- if (!$this->em->hasFilters()) { |
|
484
|
+ if ( ! $this->em->hasFilters()) { |
485
|
485
|
return ''; |
486
|
486
|
} |
487
|
487
|
|
488
|
|
- switch($targetEntity->inheritanceType) { |
|
488
|
+ switch ($targetEntity->inheritanceType) { |
489
|
489
|
case ClassMetadata::INHERITANCE_TYPE_NONE: |
490
|
490
|
break; |
491
|
491
|
case ClassMetadata::INHERITANCE_TYPE_JOINED: |
|
@@ -508,7 +508,7 @@ discard block |
|
|
block discarded – undo |
508
|
508
|
$filterClauses = []; |
509
|
509
|
foreach ($this->em->getFilters()->getEnabledFilters() as $filter) { |
510
|
510
|
if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) { |
511
|
|
- $filterClauses[] = '(' . $filterExpr . ')'; |
|
511
|
+ $filterClauses[] = '('.$filterExpr.')'; |
512
|
512
|
} |
513
|
513
|
} |
514
|
514
|
|
|
@@ -540,7 +540,7 @@ discard block |
|
|
block discarded – undo |
540
|
540
|
} |
541
|
541
|
|
542
|
542
|
if ( ! $AST->orderByClause && ($orderBySql = $this->_generateOrderedCollectionOrderByItems())) { |
543
|
|
- $sql .= ' ORDER BY ' . $orderBySql; |
|
543
|
+ $sql .= ' ORDER BY '.$orderBySql; |
544
|
544
|
} |
545
|
545
|
|
546
|
546
|
if ($limit !== null || $offset !== null) { |
|
@@ -552,11 +552,11 @@ discard block |
|
|
block discarded – undo |
552
|
552
|
} |
553
|
553
|
|
554
|
554
|
if ($lockMode === LockMode::PESSIMISTIC_READ) { |
555
|
|
- return $sql . ' ' . $this->platform->getReadLockSQL(); |
|
555
|
+ return $sql.' '.$this->platform->getReadLockSQL(); |
556
|
556
|
} |
557
|
557
|
|
558
|
558
|
if ($lockMode === LockMode::PESSIMISTIC_WRITE) { |
559
|
|
- return $sql . ' ' . $this->platform->getWriteLockSQL(); |
|
559
|
+ return $sql.' '.$this->platform->getWriteLockSQL(); |
560
|
560
|
} |
561
|
561
|
|
562
|
562
|
if ($lockMode !== LockMode::OPTIMISTIC) { |
|
@@ -611,7 +611,7 @@ discard block |
|
|
block discarded – undo |
611
|
611
|
$sqlParts = []; |
612
|
612
|
|
613
|
613
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($class, $this->platform) as $columnName) { |
614
|
|
- $sqlParts[] = $tableAlias . '.' . $columnName; |
|
614
|
+ $sqlParts[] = $tableAlias.'.'.$columnName; |
615
|
615
|
} |
616
|
616
|
|
617
|
617
|
return implode(', ', $sqlParts); |
|
@@ -654,7 +654,7 @@ discard block |
|
|
block discarded – undo |
654
|
654
|
$class = $this->queryComponents[$dqlAlias]['metadata']; |
655
|
655
|
|
656
|
656
|
if ($this->useSqlTableAliases) { |
657
|
|
- $sql .= $this->walkIdentificationVariable($dqlAlias, $fieldName) . '.'; |
|
657
|
+ $sql .= $this->walkIdentificationVariable($dqlAlias, $fieldName).'.'; |
658
|
658
|
} |
659
|
659
|
|
660
|
660
|
$sql .= $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
|
@@ -683,7 +683,7 @@ discard block |
|
|
block discarded – undo |
683
|
683
|
} |
684
|
684
|
|
685
|
685
|
if ($this->useSqlTableAliases) { |
686
|
|
- $sql .= $this->getSQLTableAlias($class->getTableName(), $dqlAlias) . '.'; |
|
686
|
+ $sql .= $this->getSQLTableAlias($class->getTableName(), $dqlAlias).'.'; |
687
|
687
|
} |
688
|
688
|
|
689
|
689
|
$sql .= reset($assoc['targetToSourceKeyColumns']); |
|
@@ -701,7 +701,7 @@ discard block |
|
|
block discarded – undo |
701
|
701
|
*/ |
702
|
702
|
public function walkSelectClause($selectClause) |
703
|
703
|
{ |
704
|
|
- $sql = 'SELECT ' . (($selectClause->isDistinct) ? 'DISTINCT ' : ''); |
|
704
|
+ $sql = 'SELECT '.(($selectClause->isDistinct) ? 'DISTINCT ' : ''); |
705
|
705
|
$sqlSelectExpressions = array_filter(array_map([$this, 'walkSelectExpression'], $selectClause->selectExpressions)); |
706
|
706
|
|
707
|
707
|
if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && $selectClause->isDistinct) { |
|
@@ -738,7 +738,7 @@ discard block |
|
|
block discarded – undo |
738
|
738
|
$discrColumn = $rootClass->discriminatorColumn; |
739
|
739
|
$columnAlias = $this->getSQLColumnAlias($discrColumn['name']); |
740
|
740
|
|
741
|
|
- $sqlSelectExpressions[] = $tblAlias . '.' . $discrColumn['name'] . ' AS ' . $columnAlias; |
|
741
|
+ $sqlSelectExpressions[] = $tblAlias.'.'.$discrColumn['name'].' AS '.$columnAlias; |
742
|
742
|
|
743
|
743
|
$this->rsm->setDiscriminatorColumn($dqlAlias, $columnAlias); |
744
|
744
|
$this->rsm->addMetaResult($dqlAlias, $columnAlias, $discrColumn['fieldName'], false, $discrColumn['type']); |
|
@@ -752,7 +752,7 @@ discard block |
|
|
block discarded – undo |
752
|
752
|
// Add foreign key columns of class and also parent classes |
753
|
753
|
foreach ($class->associationMappings as $assoc) { |
754
|
754
|
if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) |
755
|
|
- || ( ! $addMetaColumns && !isset($assoc['id']))) { |
|
755
|
+ || ( ! $addMetaColumns && ! isset($assoc['id']))) { |
756
|
756
|
continue; |
757
|
757
|
} |
758
|
758
|
|
|
@@ -767,7 +767,7 @@ discard block |
|
|
block discarded – undo |
767
|
767
|
$columnType = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em); |
768
|
768
|
|
769
|
769
|
$quotedColumnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); |
770
|
|
- $sqlSelectExpressions[] = $sqlTableAlias . '.' . $quotedColumnName . ' AS ' . $columnAlias; |
|
770
|
+ $sqlSelectExpressions[] = $sqlTableAlias.'.'.$quotedColumnName.' AS '.$columnAlias; |
771
|
771
|
|
772
|
772
|
$this->rsm->addMetaResult($dqlAlias, $columnAlias, $columnName, $isIdentifier, $columnType); |
773
|
773
|
} |
|
@@ -796,7 +796,7 @@ discard block |
|
|
block discarded – undo |
796
|
796
|
$columnType = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em); |
797
|
797
|
|
798
|
798
|
$quotedColumnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $subClass, $this->platform); |
799
|
|
- $sqlSelectExpressions[] = $sqlTableAlias . '.' . $quotedColumnName . ' AS ' . $columnAlias; |
|
799
|
+ $sqlSelectExpressions[] = $sqlTableAlias.'.'.$quotedColumnName.' AS '.$columnAlias; |
800
|
800
|
|
801
|
801
|
$this->rsm->addMetaResult($dqlAlias, $columnAlias, $columnName, $subClass->isIdentifier($columnName), $columnType); |
802
|
802
|
} |
|
@@ -822,7 +822,7 @@ discard block |
|
|
block discarded – undo |
822
|
822
|
$sqlParts[] = $this->walkIdentificationVariableDeclaration($identificationVariableDecl); |
823
|
823
|
} |
824
|
824
|
|
825
|
|
- return ' FROM ' . implode(', ', $sqlParts); |
|
825
|
+ return ' FROM '.implode(', ', $sqlParts); |
826
|
826
|
} |
827
|
827
|
|
828
|
828
|
/** |
|
@@ -876,7 +876,7 @@ discard block |
|
|
block discarded – undo |
876
|
876
|
|
877
|
877
|
$association = $class->associationMappings[$fieldName]; |
878
|
878
|
|
879
|
|
- if (! $association['isOwningSide']) { |
|
879
|
+ if ( ! $association['isOwningSide']) { |
880
|
880
|
throw QueryException::associationPathInverseSideNotSupported($pathExpression); |
881
|
881
|
} |
882
|
882
|
|
|
@@ -930,7 +930,7 @@ discard block |
|
|
block discarded – undo |
930
|
930
|
} |
931
|
931
|
|
932
|
932
|
$sql = $this->platform->appendLockHint( |
933
|
|
- $this->quoteStrategy->getTableName($class, $this->platform) . ' ' . |
|
933
|
+ $this->quoteStrategy->getTableName($class, $this->platform).' '. |
934
|
934
|
$this->getSQLTableAlias($class->getTableName(), $dqlAlias), |
935
|
935
|
$this->query->getHint(Query::HINT_LOCK_MODE) |
936
|
936
|
); |
|
@@ -942,10 +942,10 @@ discard block |
|
|
block discarded – undo |
942
|
942
|
$classTableInheritanceJoins = $this->_generateClassTableInheritanceJoins($class, $dqlAlias); |
943
|
943
|
|
944
|
944
|
if ( ! $buildNestedJoins) { |
945
|
|
- return $sql . $classTableInheritanceJoins; |
|
945
|
+ return $sql.$classTableInheritanceJoins; |
946
|
946
|
} |
947
|
947
|
|
948
|
|
- return $classTableInheritanceJoins === '' ? $sql : '(' . $sql . $classTableInheritanceJoins . ')'; |
|
948
|
+ return $classTableInheritanceJoins === '' ? $sql : '('.$sql.$classTableInheritanceJoins.')'; |
949
|
949
|
} |
950
|
950
|
|
951
|
951
|
/** |
|
@@ -978,7 +978,7 @@ discard block |
|
|
block discarded – undo |
978
|
978
|
// Ensure we got the owning side, since it has all mapping info |
979
|
979
|
$assoc = ( ! $relation['isOwningSide']) ? $targetClass->associationMappings[$relation['mappedBy']] : $relation; |
980
|
980
|
|
981
|
|
- if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && (!$this->query->getHint(self::HINT_DISTINCT) || isset($this->selectedClasses[$joinedDqlAlias]))) { |
|
981
|
+ if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && ( ! $this->query->getHint(self::HINT_DISTINCT) || isset($this->selectedClasses[$joinedDqlAlias]))) { |
982
|
982
|
if ($relation['type'] == ClassMetadata::ONE_TO_MANY || $relation['type'] == ClassMetadata::MANY_TO_MANY) { |
983
|
983
|
throw QueryException::iterateWithFetchJoinNotAllowed($assoc); |
984
|
984
|
} |
|
@@ -998,12 +998,12 @@ discard block |
|
|
block discarded – undo |
998
|
998
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
999
|
999
|
|
1000
|
1000
|
if ($relation['isOwningSide']) { |
1001
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedSourceColumn . ' = ' . $targetTableAlias . '.' . $quotedTargetColumn; |
|
1001
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedSourceColumn.' = '.$targetTableAlias.'.'.$quotedTargetColumn; |
1002
|
1002
|
|
1003
|
1003
|
continue; |
1004
|
1004
|
} |
1005
|
1005
|
|
1006
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $targetTableAlias . '.' . $quotedSourceColumn; |
|
1006
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$targetTableAlias.'.'.$quotedSourceColumn; |
1007
|
1007
|
} |
1008
|
1008
|
|
1009
|
1009
|
// Apply remaining inheritance restrictions |
|
@@ -1021,7 +1021,7 @@ discard block |
|
|
block discarded – undo |
1021
|
1021
|
} |
1022
|
1022
|
|
1023
|
1023
|
$targetTableJoin = [ |
1024
|
|
- 'table' => $targetTableName . ' ' . $targetTableAlias, |
|
1024
|
+ 'table' => $targetTableName.' '.$targetTableAlias, |
1025
|
1025
|
'condition' => implode(' AND ', $conditions), |
1026
|
1026
|
]; |
1027
|
1027
|
break; |
|
@@ -1041,10 +1041,10 @@ discard block |
|
|
block discarded – undo |
1041
|
1041
|
$quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
1042
|
1042
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
1043
|
1043
|
|
1044
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
1044
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableAlias.'.'.$quotedSourceColumn; |
1045
|
1045
|
} |
1046
|
1046
|
|
1047
|
|
- $sql .= $joinTableName . ' ' . $joinTableAlias . ' ON ' . implode(' AND ', $conditions); |
|
1047
|
+ $sql .= $joinTableName.' '.$joinTableAlias.' ON '.implode(' AND ', $conditions); |
1048
|
1048
|
|
1049
|
1049
|
// Join target table |
1050
|
1050
|
$sql .= ($joinType == AST\Join::JOIN_TYPE_LEFT || $joinType == AST\Join::JOIN_TYPE_LEFTOUTER) ? ' LEFT JOIN ' : ' INNER JOIN '; |
|
@@ -1058,7 +1058,7 @@ discard block |
|
|
block discarded – undo |
1058
|
1058
|
$quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
1059
|
1059
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
1060
|
1060
|
|
1061
|
|
- $conditions[] = $targetTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
1061
|
+ $conditions[] = $targetTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableAlias.'.'.$quotedSourceColumn; |
1062
|
1062
|
} |
1063
|
1063
|
|
1064
|
1064
|
// Apply remaining inheritance restrictions |
|
@@ -1076,7 +1076,7 @@ discard block |
|
|
block discarded – undo |
1076
|
1076
|
} |
1077
|
1077
|
|
1078
|
1078
|
$targetTableJoin = [ |
1079
|
|
- 'table' => $targetTableName . ' ' . $targetTableAlias, |
|
1079
|
+ 'table' => $targetTableName.' '.$targetTableAlias, |
1080
|
1080
|
'condition' => implode(' AND ', $conditions), |
1081
|
1081
|
]; |
1082
|
1082
|
break; |
|
@@ -1086,22 +1086,22 @@ discard block |
|
|
block discarded – undo |
1086
|
1086
|
} |
1087
|
1087
|
|
1088
|
1088
|
// Handle WITH clause |
1089
|
|
- $withCondition = (null === $condExpr) ? '' : ('(' . $this->walkConditionalExpression($condExpr) . ')'); |
|
1089
|
+ $withCondition = (null === $condExpr) ? '' : ('('.$this->walkConditionalExpression($condExpr).')'); |
1090
|
1090
|
|
1091
|
1091
|
if ($targetClass->isInheritanceTypeJoined()) { |
1092
|
1092
|
$ctiJoins = $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias); |
1093
|
1093
|
// If we have WITH condition, we need to build nested joins for target class table and cti joins |
1094
|
1094
|
if ($withCondition) { |
1095
|
|
- $sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition']; |
|
1095
|
+ $sql .= '('.$targetTableJoin['table'].$ctiJoins.') ON '.$targetTableJoin['condition']; |
1096
|
1096
|
} else { |
1097
|
|
- $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'] . $ctiJoins; |
|
1097
|
+ $sql .= $targetTableJoin['table'].' ON '.$targetTableJoin['condition'].$ctiJoins; |
1098
|
1098
|
} |
1099
|
1099
|
} else { |
1100
|
|
- $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition']; |
|
1100
|
+ $sql .= $targetTableJoin['table'].' ON '.$targetTableJoin['condition']; |
1101
|
1101
|
} |
1102
|
1102
|
|
1103
|
1103
|
if ($withCondition) { |
1104
|
|
- $sql .= ' AND ' . $withCondition; |
|
1104
|
+ $sql .= ' AND '.$withCondition; |
1105
|
1105
|
} |
1106
|
1106
|
|
1107
|
1107
|
// Apply the indexes |
|
@@ -1134,7 +1134,7 @@ discard block |
|
|
block discarded – undo |
1134
|
1134
|
$orderByItems = array_merge($orderByItems, (array) $collectionOrderByItems); |
1135
|
1135
|
} |
1136
|
1136
|
|
1137
|
|
- return ' ORDER BY ' . implode(', ', $orderByItems); |
|
1137
|
+ return ' ORDER BY '.implode(', ', $orderByItems); |
1138
|
1138
|
} |
1139
|
1139
|
|
1140
|
1140
|
/** |
|
@@ -1151,10 +1151,10 @@ discard block |
|
|
block discarded – undo |
1151
|
1151
|
$this->orderedColumnsMap[$sql] = $type; |
1152
|
1152
|
|
1153
|
1153
|
if ($expr instanceof AST\Subselect) { |
1154
|
|
- return '(' . $sql . ') ' . $type; |
|
1154
|
+ return '('.$sql.') '.$type; |
1155
|
1155
|
} |
1156
|
1156
|
|
1157
|
|
- return $sql . ' ' . $type; |
|
1157
|
+ return $sql.' '.$type; |
1158
|
1158
|
} |
1159
|
1159
|
|
1160
|
1160
|
/** |
|
@@ -1162,7 +1162,7 @@ discard block |
|
|
block discarded – undo |
1162
|
1162
|
*/ |
1163
|
1163
|
public function walkHavingClause($havingClause) |
1164
|
1164
|
{ |
1165
|
|
- return ' HAVING ' . $this->walkConditionalExpression($havingClause->conditionalExpression); |
|
1165
|
+ return ' HAVING '.$this->walkConditionalExpression($havingClause->conditionalExpression); |
1166
|
1166
|
} |
1167
|
1167
|
|
1168
|
1168
|
/** |
|
@@ -1185,7 +1185,7 @@ discard block |
|
|
block discarded – undo |
1185
|
1185
|
$conditions = []; |
1186
|
1186
|
|
1187
|
1187
|
if ($join->conditionalExpression) { |
1188
|
|
- $conditions[] = '(' . $this->walkConditionalExpression($join->conditionalExpression) . ')'; |
|
1188
|
+ $conditions[] = '('.$this->walkConditionalExpression($join->conditionalExpression).')'; |
1189
|
1189
|
} |
1190
|
1190
|
|
1191
|
1191
|
$isUnconditionalJoin = empty($conditions); |
|
@@ -1193,7 +1193,7 @@ discard block |
|
|
block discarded – undo |
1193
|
1193
|
? ' AND ' |
1194
|
1194
|
: ' ON '; |
1195
|
1195
|
|
1196
|
|
- $sql .= $this->generateRangeVariableDeclarationSQL($joinDeclaration, !$isUnconditionalJoin); |
|
1196
|
+ $sql .= $this->generateRangeVariableDeclarationSQL($joinDeclaration, ! $isUnconditionalJoin); |
1197
|
1197
|
|
1198
|
1198
|
// Apply remaining inheritance restrictions |
1199
|
1199
|
$discrSql = $this->_generateDiscriminatorColumnConditionSQL([$dqlAlias]); |
|
@@ -1210,7 +1210,7 @@ discard block |
|
|
block discarded – undo |
1210
|
1210
|
} |
1211
|
1211
|
|
1212
|
1212
|
if ($conditions) { |
1213
|
|
- $sql .= $condExprConjunction . implode(' AND ', $conditions); |
|
1213
|
+ $sql .= $condExprConjunction.implode(' AND ', $conditions); |
1214
|
1214
|
} |
1215
|
1215
|
|
1216
|
1216
|
break; |
|
@@ -1240,7 +1240,7 @@ discard block |
|
|
block discarded – undo |
1240
|
1240
|
$scalarExpressions[] = $this->walkSimpleArithmeticExpression($scalarExpression); |
1241
|
1241
|
} |
1242
|
1242
|
|
1243
|
|
- $sql .= implode(', ', $scalarExpressions) . ')'; |
|
1243
|
+ $sql .= implode(', ', $scalarExpressions).')'; |
1244
|
1244
|
|
1245
|
1245
|
return $sql; |
1246
|
1246
|
} |
|
@@ -1262,7 +1262,7 @@ discard block |
|
|
block discarded – undo |
1262
|
1262
|
? $this->conn->quote($nullIfExpression->secondExpression) |
1263
|
1263
|
: $this->walkSimpleArithmeticExpression($nullIfExpression->secondExpression); |
1264
|
1264
|
|
1265
|
|
- return 'NULLIF(' . $firstExpression . ', ' . $secondExpression . ')'; |
|
1265
|
+ return 'NULLIF('.$firstExpression.', '.$secondExpression.')'; |
1266
|
1266
|
} |
1267
|
1267
|
|
1268
|
1268
|
/** |
|
@@ -1277,11 +1277,11 @@ discard block |
|
|
block discarded – undo |
1277
|
1277
|
$sql = 'CASE'; |
1278
|
1278
|
|
1279
|
1279
|
foreach ($generalCaseExpression->whenClauses as $whenClause) { |
1280
|
|
- $sql .= ' WHEN ' . $this->walkConditionalExpression($whenClause->caseConditionExpression); |
1281
|
|
- $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
|
1280
|
+ $sql .= ' WHEN '.$this->walkConditionalExpression($whenClause->caseConditionExpression); |
|
1281
|
+ $sql .= ' THEN '.$this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
1282
|
1282
|
} |
1283
|
1283
|
|
1284
|
|
- $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression) . ' END'; |
|
1284
|
+ $sql .= ' ELSE '.$this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression).' END'; |
1285
|
1285
|
|
1286
|
1286
|
return $sql; |
1287
|
1287
|
} |
|
@@ -1295,14 +1295,14 @@ discard block |
|
|
block discarded – undo |
1295
|
1295
|
*/ |
1296
|
1296
|
public function walkSimpleCaseExpression($simpleCaseExpression) |
1297
|
1297
|
{ |
1298
|
|
- $sql = 'CASE ' . $this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
|
1298
|
+ $sql = 'CASE '.$this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
1299
|
1299
|
|
1300
|
1300
|
foreach ($simpleCaseExpression->simpleWhenClauses as $simpleWhenClause) { |
1301
|
|
- $sql .= ' WHEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
1302
|
|
- $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
|
1301
|
+ $sql .= ' WHEN '.$this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
|
1302
|
+ $sql .= ' THEN '.$this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
1303
|
1303
|
} |
1304
|
1304
|
|
1305
|
|
- $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression) . ' END'; |
|
1305
|
+ $sql .= ' ELSE '.$this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression).' END'; |
1306
|
1306
|
|
1307
|
1307
|
return $sql; |
1308
|
1308
|
} |
|
@@ -1336,14 +1336,14 @@ discard block |
|
|
block discarded – undo |
1336
|
1336
|
$fieldMapping = $class->fieldMappings[$fieldName]; |
1337
|
1337
|
$columnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
1338
|
1338
|
$columnAlias = $this->getSQLColumnAlias($fieldMapping['columnName']); |
1339
|
|
- $col = $sqlTableAlias . '.' . $columnName; |
|
1339
|
+ $col = $sqlTableAlias.'.'.$columnName; |
1340
|
1340
|
|
1341
|
1341
|
if (isset($fieldMapping['requireSQLConversion'])) { |
1342
|
1342
|
$type = Type::getType($fieldMapping['type']); |
1343
|
1343
|
$col = $type->convertToPHPValueSQL($col, $this->conn->getDatabasePlatform()); |
1344
|
1344
|
} |
1345
|
1345
|
|
1346
|
|
- $sql .= $col . ' AS ' . $columnAlias; |
|
1346
|
+ $sql .= $col.' AS '.$columnAlias; |
1347
|
1347
|
|
1348
|
1348
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
1349
|
1349
|
|
|
@@ -1368,7 +1368,7 @@ discard block |
|
|
block discarded – undo |
1368
|
1368
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
1369
|
1369
|
$resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
1370
|
1370
|
|
1371
|
|
- $sql .= $expr->dispatch($this) . ' AS ' . $columnAlias; |
|
1371
|
+ $sql .= $expr->dispatch($this).' AS '.$columnAlias; |
1372
|
1372
|
|
1373
|
1373
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
1374
|
1374
|
|
|
@@ -1382,7 +1382,7 @@ discard block |
|
|
block discarded – undo |
1382
|
1382
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
1383
|
1383
|
$resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
1384
|
1384
|
|
1385
|
|
- $sql .= '(' . $this->walkSubselect($expr) . ') AS ' . $columnAlias; |
|
1385
|
+ $sql .= '('.$this->walkSubselect($expr).') AS '.$columnAlias; |
1386
|
1386
|
|
1387
|
1387
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
1388
|
1388
|
|
|
@@ -1393,7 +1393,7 @@ discard block |
|
|
block discarded – undo |
1393
|
1393
|
break; |
1394
|
1394
|
|
1395
|
1395
|
case ($expr instanceof AST\NewObjectExpression): |
1396
|
|
- $sql .= $this->walkNewObject($expr,$selectExpression->fieldIdentificationVariable); |
|
1396
|
+ $sql .= $this->walkNewObject($expr, $selectExpression->fieldIdentificationVariable); |
1397
|
1397
|
break; |
1398
|
1398
|
|
1399
|
1399
|
default: |
|
@@ -1434,14 +1434,14 @@ discard block |
|
|
block discarded – undo |
1434
|
1434
|
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
1435
|
1435
|
$quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
1436
|
1436
|
|
1437
|
|
- $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
1437
|
+ $col = $sqlTableAlias.'.'.$quotedColumnName; |
1438
|
1438
|
|
1439
|
1439
|
if (isset($mapping['requireSQLConversion'])) { |
1440
|
1440
|
$type = Type::getType($mapping['type']); |
1441
|
1441
|
$col = $type->convertToPHPValueSQL($col, $this->platform); |
1442
|
1442
|
} |
1443
|
1443
|
|
1444
|
|
- $sqlParts[] = $col . ' AS '. $columnAlias; |
|
1444
|
+ $sqlParts[] = $col.' AS '.$columnAlias; |
1445
|
1445
|
|
1446
|
1446
|
$this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
1447
|
1447
|
|
|
@@ -1458,21 +1458,21 @@ discard block |
|
|
block discarded – undo |
1458
|
1458
|
$sqlTableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias); |
1459
|
1459
|
|
1460
|
1460
|
foreach ($subClass->fieldMappings as $fieldName => $mapping) { |
1461
|
|
- if (isset($mapping['inherited']) || ($partialFieldSet && !in_array($fieldName, $partialFieldSet))) { |
|
1461
|
+ if (isset($mapping['inherited']) || ($partialFieldSet && ! in_array($fieldName, $partialFieldSet))) { |
1462
|
1462
|
continue; |
1463
|
1463
|
} |
1464
|
1464
|
|
1465
|
1465
|
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
1466
|
1466
|
$quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $subClass, $this->platform); |
1467
|
1467
|
|
1468
|
|
- $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
1468
|
+ $col = $sqlTableAlias.'.'.$quotedColumnName; |
1469
|
1469
|
|
1470
|
1470
|
if (isset($mapping['requireSQLConversion'])) { |
1471
|
1471
|
$type = Type::getType($mapping['type']); |
1472
|
1472
|
$col = $type->convertToPHPValueSQL($col, $this->platform); |
1473
|
1473
|
} |
1474
|
1474
|
|
1475
|
|
- $sqlParts[] = $col . ' AS ' . $columnAlias; |
|
1475
|
+ $sqlParts[] = $col.' AS '.$columnAlias; |
1476
|
1476
|
|
1477
|
1477
|
$this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
1478
|
1478
|
|
|
@@ -1492,7 +1492,7 @@ discard block |
|
|
block discarded – undo |
1492
|
1492
|
*/ |
1493
|
1493
|
public function walkQuantifiedExpression($qExpr) |
1494
|
1494
|
{ |
1495
|
|
- return ' ' . strtoupper($qExpr->type) . '(' . $this->walkSubselect($qExpr->subselect) . ')'; |
|
1495
|
+ return ' '.strtoupper($qExpr->type).'('.$this->walkSubselect($qExpr->subselect).')'; |
1496
|
1496
|
} |
1497
|
1497
|
|
1498
|
1498
|
/** |
|
@@ -1532,7 +1532,7 @@ discard block |
|
|
block discarded – undo |
1532
|
1532
|
$sqlParts[] = $this->walkIdentificationVariableDeclaration($subselectIdVarDecl); |
1533
|
1533
|
} |
1534
|
1534
|
|
1535
|
|
- return ' FROM ' . implode(', ', $sqlParts); |
|
1535
|
+ return ' FROM '.implode(', ', $sqlParts); |
1536
|
1536
|
} |
1537
|
1537
|
|
1538
|
1538
|
/** |
|
@@ -1540,7 +1540,7 @@ discard block |
|
|
block discarded – undo |
1540
|
1540
|
*/ |
1541
|
1541
|
public function walkSimpleSelectClause($simpleSelectClause) |
1542
|
1542
|
{ |
1543
|
|
- return 'SELECT' . ($simpleSelectClause->isDistinct ? ' DISTINCT' : '') |
|
1543
|
+ return 'SELECT'.($simpleSelectClause->isDistinct ? ' DISTINCT' : '') |
1544
|
1544
|
. $this->walkSimpleSelectExpression($simpleSelectClause->simpleSelectExpression); |
1545
|
1545
|
} |
1546
|
1546
|
|
|
@@ -1559,10 +1559,10 @@ discard block |
|
|
block discarded – undo |
1559
|
1559
|
* @param null|string $newObjectResultAlias |
1560
|
1560
|
* @return string The SQL. |
1561
|
1561
|
*/ |
1562
|
|
- public function walkNewObject($newObjectExpression, $newObjectResultAlias=null) |
|
1562
|
+ public function walkNewObject($newObjectExpression, $newObjectResultAlias = null) |
1563
|
1563
|
{ |
1564
|
1564
|
$sqlSelectExpressions = []; |
1565
|
|
- $objIndex = $newObjectResultAlias?:$this->newObjectCounter++; |
|
1565
|
+ $objIndex = $newObjectResultAlias ?: $this->newObjectCounter++; |
1566
|
1566
|
|
1567
|
1567
|
foreach ($newObjectExpression->args as $argIndex => $e) { |
1568
|
1568
|
$resultAlias = $this->scalarResultCounter++; |
|
@@ -1575,7 +1575,7 @@ discard block |
|
|
block discarded – undo |
1575
|
1575
|
break; |
1576
|
1576
|
|
1577
|
1577
|
case ($e instanceof AST\Subselect): |
1578
|
|
- $sqlSelectExpressions[] = '(' . $e->dispatch($this) . ') AS ' . $columnAlias; |
|
1578
|
+ $sqlSelectExpressions[] = '('.$e->dispatch($this).') AS '.$columnAlias; |
1579
|
1579
|
break; |
1580
|
1580
|
|
1581
|
1581
|
case ($e instanceof AST\PathExpression): |
|
@@ -1584,7 +1584,7 @@ discard block |
|
|
block discarded – undo |
1584
|
1584
|
$class = $qComp['metadata']; |
1585
|
1585
|
$fieldType = $class->fieldMappings[$e->field]['type']; |
1586
|
1586
|
|
1587
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
1587
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
1588
|
1588
|
break; |
1589
|
1589
|
|
1590
|
1590
|
case ($e instanceof AST\Literal): |
|
@@ -1598,11 +1598,11 @@ discard block |
|
|
block discarded – undo |
1598
|
1598
|
break; |
1599
|
1599
|
} |
1600
|
1600
|
|
1601
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
1601
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
1602
|
1602
|
break; |
1603
|
1603
|
|
1604
|
1604
|
default: |
1605
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
1605
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
1606
|
1606
|
break; |
1607
|
1607
|
} |
1608
|
1608
|
|
|
@@ -1635,10 +1635,10 @@ discard block |
|
|
block discarded – undo |
1635
|
1635
|
case ($expr instanceof AST\Subselect): |
1636
|
1636
|
$alias = $simpleSelectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
1637
|
1637
|
|
1638
|
|
- $columnAlias = 'sclr' . $this->aliasCounter++; |
|
1638
|
+ $columnAlias = 'sclr'.$this->aliasCounter++; |
1639
|
1639
|
$this->scalarResultAliasMap[$alias] = $columnAlias; |
1640
|
1640
|
|
1641
|
|
- $sql .= '(' . $this->walkSubselect($expr) . ') AS ' . $columnAlias; |
|
1641
|
+ $sql .= '('.$this->walkSubselect($expr).') AS '.$columnAlias; |
1642
|
1642
|
break; |
1643
|
1643
|
|
1644
|
1644
|
case ($expr instanceof AST\Functions\FunctionNode): |
|
@@ -1655,7 +1655,7 @@ discard block |
|
|
block discarded – undo |
1655
|
1655
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
1656
|
1656
|
$this->scalarResultAliasMap[$alias] = $columnAlias; |
1657
|
1657
|
|
1658
|
|
- $sql .= $expr->dispatch($this) . ' AS ' . $columnAlias; |
|
1658
|
+ $sql .= $expr->dispatch($this).' AS '.$columnAlias; |
1659
|
1659
|
break; |
1660
|
1660
|
|
1661
|
1661
|
case ($expr instanceof AST\ParenthesisExpression): |
|
@@ -1675,8 +1675,8 @@ discard block |
|
|
block discarded – undo |
1675
|
1675
|
*/ |
1676
|
1676
|
public function walkAggregateExpression($aggExpression) |
1677
|
1677
|
{ |
1678
|
|
- return $aggExpression->functionName . '(' . ($aggExpression->isDistinct ? 'DISTINCT ' : '') |
1679
|
|
- . $this->walkSimpleArithmeticExpression($aggExpression->pathExpression) . ')'; |
|
1678
|
+ return $aggExpression->functionName.'('.($aggExpression->isDistinct ? 'DISTINCT ' : '') |
|
1679
|
+ . $this->walkSimpleArithmeticExpression($aggExpression->pathExpression).')'; |
1680
|
1680
|
} |
1681
|
1681
|
|
1682
|
1682
|
/** |
|
@@ -1690,7 +1690,7 @@ discard block |
|
|
block discarded – undo |
1690
|
1690
|
$sqlParts[] = $this->walkGroupByItem($groupByItem); |
1691
|
1691
|
} |
1692
|
1692
|
|
1693
|
|
- return ' GROUP BY ' . implode(', ', $sqlParts); |
|
1693
|
+ return ' GROUP BY '.implode(', ', $sqlParts); |
1694
|
1694
|
} |
1695
|
1695
|
|
1696
|
1696
|
/** |
|
@@ -1747,7 +1747,7 @@ discard block |
|
|
block discarded – undo |
1747
|
1747
|
{ |
1748
|
1748
|
$class = $this->em->getClassMetadata($deleteClause->abstractSchemaName); |
1749
|
1749
|
$tableName = $class->getTableName(); |
1750
|
|
- $sql = 'DELETE FROM ' . $this->quoteStrategy->getTableName($class, $this->platform); |
|
1750
|
+ $sql = 'DELETE FROM '.$this->quoteStrategy->getTableName($class, $this->platform); |
1751
|
1751
|
|
1752
|
1752
|
$this->setSQLTableAlias($tableName, $tableName, $deleteClause->aliasIdentificationVariable); |
1753
|
1753
|
$this->rootAliases[] = $deleteClause->aliasIdentificationVariable; |
|
@@ -1762,12 +1762,12 @@ discard block |
|
|
block discarded – undo |
1762
|
1762
|
{ |
1763
|
1763
|
$class = $this->em->getClassMetadata($updateClause->abstractSchemaName); |
1764
|
1764
|
$tableName = $class->getTableName(); |
1765
|
|
- $sql = 'UPDATE ' . $this->quoteStrategy->getTableName($class, $this->platform); |
|
1765
|
+ $sql = 'UPDATE '.$this->quoteStrategy->getTableName($class, $this->platform); |
1766
|
1766
|
|
1767
|
1767
|
$this->setSQLTableAlias($tableName, $tableName, $updateClause->aliasIdentificationVariable); |
1768
|
1768
|
$this->rootAliases[] = $updateClause->aliasIdentificationVariable; |
1769
|
1769
|
|
1770
|
|
- $sql .= ' SET ' . implode(', ', array_map([$this, 'walkUpdateItem'], $updateClause->updateItems)); |
|
1770
|
+ $sql .= ' SET '.implode(', ', array_map([$this, 'walkUpdateItem'], $updateClause->updateItems)); |
1771
|
1771
|
|
1772
|
1772
|
return $sql; |
1773
|
1773
|
} |
|
@@ -1780,7 +1780,7 @@ discard block |
|
|
block discarded – undo |
1780
|
1780
|
$useTableAliasesBefore = $this->useSqlTableAliases; |
1781
|
1781
|
$this->useSqlTableAliases = false; |
1782
|
1782
|
|
1783
|
|
- $sql = $this->walkPathExpression($updateItem->pathExpression) . ' = '; |
|
1783
|
+ $sql = $this->walkPathExpression($updateItem->pathExpression).' = '; |
1784
|
1784
|
$newValue = $updateItem->newValue; |
1785
|
1785
|
|
1786
|
1786
|
switch (true) { |
|
@@ -1823,7 +1823,7 @@ discard block |
|
|
block discarded – undo |
1823
|
1823
|
|
1824
|
1824
|
if (count($filterClauses)) { |
1825
|
1825
|
if ($condSql) { |
1826
|
|
- $condSql = '(' . $condSql . ') AND '; |
|
1826
|
+ $condSql = '('.$condSql.') AND '; |
1827
|
1827
|
} |
1828
|
1828
|
|
1829
|
1829
|
$condSql .= implode(' AND ', $filterClauses); |
|
@@ -1831,11 +1831,11 @@ discard block |
|
|
block discarded – undo |
1831
|
1831
|
} |
1832
|
1832
|
|
1833
|
1833
|
if ($condSql) { |
1834
|
|
- return ' WHERE ' . (( ! $discrSql) ? $condSql : '(' . $condSql . ') AND ' . $discrSql); |
|
1834
|
+ return ' WHERE '.(( ! $discrSql) ? $condSql : '('.$condSql.') AND '.$discrSql); |
1835
|
1835
|
} |
1836
|
1836
|
|
1837
|
1837
|
if ($discrSql) { |
1838
|
|
- return ' WHERE ' . $discrSql; |
|
1838
|
+ return ' WHERE '.$discrSql; |
1839
|
1839
|
} |
1840
|
1840
|
|
1841
|
1841
|
return ''; |
|
@@ -1878,7 +1878,7 @@ discard block |
|
|
block discarded – undo |
1878
|
1878
|
// if only one ConditionalPrimary is defined |
1879
|
1879
|
return ( ! ($factor instanceof AST\ConditionalFactor)) |
1880
|
1880
|
? $this->walkConditionalPrimary($factor) |
1881
|
|
- : ($factor->not ? 'NOT ' : '') . $this->walkConditionalPrimary($factor->conditionalPrimary); |
|
1881
|
+ : ($factor->not ? 'NOT ' : '').$this->walkConditionalPrimary($factor->conditionalPrimary); |
1882
|
1882
|
} |
1883
|
1883
|
|
1884
|
1884
|
/** |
|
@@ -1893,7 +1893,7 @@ discard block |
|
|
block discarded – undo |
1893
|
1893
|
if ($primary->isConditionalExpression()) { |
1894
|
1894
|
$condExpr = $primary->conditionalExpression; |
1895
|
1895
|
|
1896
|
|
- return '(' . $this->walkConditionalExpression($condExpr) . ')'; |
|
1896
|
+ return '('.$this->walkConditionalExpression($condExpr).')'; |
1897
|
1897
|
} |
1898
|
1898
|
} |
1899
|
1899
|
|
|
@@ -1904,7 +1904,7 @@ discard block |
|
|
block discarded – undo |
1904
|
1904
|
{ |
1905
|
1905
|
$sql = ($existsExpr->not) ? 'NOT ' : ''; |
1906
|
1906
|
|
1907
|
|
- $sql .= 'EXISTS (' . $this->walkSubselect($existsExpr->subselect) . ')'; |
|
1907
|
+ $sql .= 'EXISTS ('.$this->walkSubselect($existsExpr->subselect).')'; |
1908
|
1908
|
|
1909
|
1909
|
return $sql; |
1910
|
1910
|
} |
|
@@ -1948,7 +1948,7 @@ discard block |
|
|
block discarded – undo |
1948
|
1948
|
$targetTableAlias = $this->getSQLTableAlias($targetClass->getTableName()); |
1949
|
1949
|
$sourceTableAlias = $this->getSQLTableAlias($class->getTableName(), $dqlAlias); |
1950
|
1950
|
|
1951
|
|
- $sql .= $this->quoteStrategy->getTableName($targetClass, $this->platform) . ' ' . $targetTableAlias . ' WHERE '; |
|
1951
|
+ $sql .= $this->quoteStrategy->getTableName($targetClass, $this->platform).' '.$targetTableAlias.' WHERE '; |
1952
|
1952
|
|
1953
|
1953
|
$owningAssoc = $targetClass->associationMappings[$assoc['mappedBy']]; |
1954
|
1954
|
$sqlParts = []; |
|
@@ -1956,7 +1956,7 @@ discard block |
|
|
block discarded – undo |
1956
|
1956
|
foreach ($owningAssoc['targetToSourceKeyColumns'] as $targetColumn => $sourceColumn) { |
1957
|
1957
|
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$targetColumn], $class, $this->platform); |
1958
|
1958
|
|
1959
|
|
- $sqlParts[] = $sourceTableAlias . '.' . $targetColumn . ' = ' . $targetTableAlias . '.' . $sourceColumn; |
|
1959
|
+ $sqlParts[] = $sourceTableAlias.'.'.$targetColumn.' = '.$targetTableAlias.'.'.$sourceColumn; |
1960
|
1960
|
} |
1961
|
1961
|
|
1962
|
1962
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($targetClass, $this->platform) as $targetColumnName) { |
|
@@ -1964,7 +1964,7 @@ discard block |
|
|
block discarded – undo |
1964
|
1964
|
$this->parserResult->addParameterMapping($dqlParamKey, $this->sqlParamIndex++); |
1965
|
1965
|
} |
1966
|
1966
|
|
1967
|
|
- $sqlParts[] = $targetTableAlias . '.' . $targetColumnName . ' = ' . $entitySql; |
|
1967
|
+ $sqlParts[] = $targetTableAlias.'.'.$targetColumnName.' = '.$entitySql; |
1968
|
1968
|
} |
1969
|
1969
|
|
1970
|
1970
|
$sql .= implode(' AND ', $sqlParts); |
|
@@ -1980,8 +1980,8 @@ discard block |
|
|
block discarded – undo |
1980
|
1980
|
$sourceTableAlias = $this->getSQLTableAlias($class->getTableName(), $dqlAlias); |
1981
|
1981
|
|
1982
|
1982
|
// join to target table |
1983
|
|
- $sql .= $this->quoteStrategy->getJoinTableName($owningAssoc, $targetClass, $this->platform) . ' ' . $joinTableAlias |
1984
|
|
- . ' INNER JOIN ' . $this->quoteStrategy->getTableName($targetClass, $this->platform) . ' ' . $targetTableAlias . ' ON '; |
|
1983
|
+ $sql .= $this->quoteStrategy->getJoinTableName($owningAssoc, $targetClass, $this->platform).' '.$joinTableAlias |
|
1984
|
+ . ' INNER JOIN '.$this->quoteStrategy->getTableName($targetClass, $this->platform).' '.$targetTableAlias.' ON '; |
1985
|
1985
|
|
1986
|
1986
|
// join conditions |
1987
|
1987
|
$joinColumns = $assoc['isOwningSide'] ? $joinTable['inverseJoinColumns'] : $joinTable['joinColumns']; |
|
@@ -1990,7 +1990,7 @@ discard block |
|
|
block discarded – undo |
1990
|
1990
|
foreach ($joinColumns as $joinColumn) { |
1991
|
1991
|
$targetColumn = $this->quoteStrategy->getColumnName($targetClass->fieldNames[$joinColumn['referencedColumnName']], $targetClass, $this->platform); |
1992
|
1992
|
|
1993
|
|
- $joinSqlParts[] = $joinTableAlias . '.' . $joinColumn['name'] . ' = ' . $targetTableAlias . '.' . $targetColumn; |
|
1993
|
+ $joinSqlParts[] = $joinTableAlias.'.'.$joinColumn['name'].' = '.$targetTableAlias.'.'.$targetColumn; |
1994
|
1994
|
} |
1995
|
1995
|
|
1996
|
1996
|
$sql .= implode(' AND ', $joinSqlParts); |
|
@@ -2002,7 +2002,7 @@ discard block |
|
|
block discarded – undo |
2002
|
2002
|
foreach ($joinColumns as $joinColumn) { |
2003
|
2003
|
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$joinColumn['referencedColumnName']], $class, $this->platform); |
2004
|
2004
|
|
2005
|
|
- $sqlParts[] = $joinTableAlias . '.' . $joinColumn['name'] . ' = ' . $sourceTableAlias . '.' . $targetColumn; |
|
2005
|
+ $sqlParts[] = $joinTableAlias.'.'.$joinColumn['name'].' = '.$sourceTableAlias.'.'.$targetColumn; |
2006
|
2006
|
} |
2007
|
2007
|
|
2008
|
2008
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($targetClass, $this->platform) as $targetColumnName) { |
|
@@ -2010,13 +2010,13 @@ discard block |
|
|
block discarded – undo |
2010
|
2010
|
$this->parserResult->addParameterMapping($dqlParamKey, $this->sqlParamIndex++); |
2011
|
2011
|
} |
2012
|
2012
|
|
2013
|
|
- $sqlParts[] = $targetTableAlias . '.' . $targetColumnName . ' IN (' . $entitySql . ')'; |
|
2013
|
+ $sqlParts[] = $targetTableAlias.'.'.$targetColumnName.' IN ('.$entitySql.')'; |
2014
|
2014
|
} |
2015
|
2015
|
|
2016
|
2016
|
$sql .= implode(' AND ', $sqlParts); |
2017
|
2017
|
} |
2018
|
2018
|
|
2019
|
|
- return $sql . ')'; |
|
2019
|
+ return $sql.')'; |
2020
|
2020
|
} |
2021
|
2021
|
|
2022
|
2022
|
/** |
|
@@ -2027,7 +2027,7 @@ discard block |
|
|
block discarded – undo |
2027
|
2027
|
$sizeFunc = new AST\Functions\SizeFunction('size'); |
2028
|
2028
|
$sizeFunc->collectionPathExpression = $emptyCollCompExpr->expression; |
2029
|
2029
|
|
2030
|
|
- return $sizeFunc->getSql($this) . ($emptyCollCompExpr->not ? ' > 0' : ' = 0'); |
|
2030
|
+ return $sizeFunc->getSql($this).($emptyCollCompExpr->not ? ' > 0' : ' = 0'); |
2031
|
2031
|
} |
2032
|
2032
|
|
2033
|
2033
|
/** |
|
@@ -2036,19 +2036,19 @@ discard block |
|
|
block discarded – undo |
2036
|
2036
|
public function walkNullComparisonExpression($nullCompExpr) |
2037
|
2037
|
{ |
2038
|
2038
|
$expression = $nullCompExpr->expression; |
2039
|
|
- $comparison = ' IS' . ($nullCompExpr->not ? ' NOT' : '') . ' NULL'; |
|
2039
|
+ $comparison = ' IS'.($nullCompExpr->not ? ' NOT' : '').' NULL'; |
2040
|
2040
|
|
2041
|
2041
|
// Handle ResultVariable |
2042
|
2042
|
if (is_string($expression) && isset($this->queryComponents[$expression]['resultVariable'])) { |
2043
|
|
- return $this->walkResultVariable($expression) . $comparison; |
|
2043
|
+ return $this->walkResultVariable($expression).$comparison; |
2044
|
2044
|
} |
2045
|
2045
|
|
2046
|
2046
|
// Handle InputParameter mapping inclusion to ParserResult |
2047
|
2047
|
if ($expression instanceof AST\InputParameter) { |
2048
|
|
- return $this->walkInputParameter($expression) . $comparison; |
|
2048
|
+ return $this->walkInputParameter($expression).$comparison; |
2049
|
2049
|
} |
2050
|
2050
|
|
2051
|
|
- return $expression->dispatch($this) . $comparison; |
|
2051
|
+ return $expression->dispatch($this).$comparison; |
2052
|
2052
|
} |
2053
|
2053
|
|
2054
|
2054
|
/** |
|
@@ -2056,7 +2056,7 @@ discard block |
|
|
block discarded – undo |
2056
|
2056
|
*/ |
2057
|
2057
|
public function walkInExpression($inExpr) |
2058
|
2058
|
{ |
2059
|
|
- $sql = $this->walkArithmeticExpression($inExpr->expression) . ($inExpr->not ? ' NOT' : '') . ' IN ('; |
|
2059
|
+ $sql = $this->walkArithmeticExpression($inExpr->expression).($inExpr->not ? ' NOT' : '').' IN ('; |
2060
|
2060
|
|
2061
|
2061
|
$sql .= ($inExpr->subselect) |
2062
|
2062
|
? $this->walkSubselect($inExpr->subselect) |
|
@@ -2083,10 +2083,10 @@ discard block |
|
|
block discarded – undo |
2083
|
2083
|
} |
2084
|
2084
|
|
2085
|
2085
|
if ($this->useSqlTableAliases) { |
2086
|
|
- $sql .= $this->getSQLTableAlias($discrClass->getTableName(), $dqlAlias) . '.'; |
|
2086
|
+ $sql .= $this->getSQLTableAlias($discrClass->getTableName(), $dqlAlias).'.'; |
2087
|
2087
|
} |
2088
|
2088
|
|
2089
|
|
- $sql .= $class->discriminatorColumn['name'] . ($instanceOfExpr->not ? ' NOT IN ' : ' IN '); |
|
2089
|
+ $sql .= $class->discriminatorColumn['name'].($instanceOfExpr->not ? ' NOT IN ' : ' IN '); |
2090
|
2090
|
$sql .= $this->getChildDiscriminatorsFromClassMetadata($discrClass, $instanceOfExpr); |
2091
|
2091
|
|
2092
|
2092
|
return $sql; |
|
@@ -2133,8 +2133,8 @@ discard block |
|
|
block discarded – undo |
2133
|
2133
|
$sql .= ' NOT'; |
2134
|
2134
|
} |
2135
|
2135
|
|
2136
|
|
- $sql .= ' BETWEEN ' . $this->walkArithmeticExpression($betweenExpr->leftBetweenExpression) |
2137
|
|
- . ' AND ' . $this->walkArithmeticExpression($betweenExpr->rightBetweenExpression); |
|
2136
|
+ $sql .= ' BETWEEN '.$this->walkArithmeticExpression($betweenExpr->leftBetweenExpression) |
|
2137
|
+ . ' AND '.$this->walkArithmeticExpression($betweenExpr->rightBetweenExpression); |
2138
|
2138
|
|
2139
|
2139
|
return $sql; |
2140
|
2140
|
} |
|
@@ -2149,7 +2149,7 @@ discard block |
|
|
block discarded – undo |
2149
|
2149
|
? $this->walkResultVariable($stringExpr) |
2150
|
2150
|
: $stringExpr->dispatch($this); |
2151
|
2151
|
|
2152
|
|
- $sql = $leftExpr . ($likeExpr->not ? ' NOT' : '') . ' LIKE '; |
|
2152
|
+ $sql = $leftExpr.($likeExpr->not ? ' NOT' : '').' LIKE '; |
2153
|
2153
|
|
2154
|
2154
|
if ($likeExpr->stringPattern instanceof AST\InputParameter) { |
2155
|
2155
|
$sql .= $this->walkInputParameter($likeExpr->stringPattern); |
|
@@ -2162,7 +2162,7 @@ discard block |
|
|
block discarded – undo |
2162
|
2162
|
} |
2163
|
2163
|
|
2164
|
2164
|
if ($likeExpr->escapeChar) { |
2165
|
|
- $sql .= ' ESCAPE ' . $this->walkLiteral($likeExpr->escapeChar); |
|
2165
|
+ $sql .= ' ESCAPE '.$this->walkLiteral($likeExpr->escapeChar); |
2166
|
2166
|
} |
2167
|
2167
|
|
2168
|
2168
|
return $sql; |
|
@@ -2189,7 +2189,7 @@ discard block |
|
|
block discarded – undo |
2189
|
2189
|
? $leftExpr->dispatch($this) |
2190
|
2190
|
: (is_numeric($leftExpr) ? $leftExpr : $this->conn->quote($leftExpr)); |
2191
|
2191
|
|
2192
|
|
- $sql .= ' ' . $compExpr->operator . ' '; |
|
2192
|
+ $sql .= ' '.$compExpr->operator.' '; |
2193
|
2193
|
|
2194
|
2194
|
$sql .= ($rightExpr instanceof AST\Node) |
2195
|
2195
|
? $rightExpr->dispatch($this) |
|
@@ -2221,7 +2221,7 @@ discard block |
|
|
block discarded – undo |
2221
|
2221
|
{ |
2222
|
2222
|
return ($arithmeticExpr->isSimpleArithmeticExpression()) |
2223
|
2223
|
? $this->walkSimpleArithmeticExpression($arithmeticExpr->simpleArithmeticExpression) |
2224
|
|
- : '(' . $this->walkSubselect($arithmeticExpr->subselect) . ')'; |
|
2224
|
+ : '('.$this->walkSubselect($arithmeticExpr->subselect).')'; |
2225
|
2225
|
} |
2226
|
2226
|
|
2227
|
2227
|
/** |
|
@@ -2275,7 +2275,7 @@ discard block |
|
|
block discarded – undo |
2275
|
2275
|
|
2276
|
2276
|
$sign = $factor->isNegativeSigned() ? '-' : ($factor->isPositiveSigned() ? '+' : ''); |
2277
|
2277
|
|
2278
|
|
- return $sign . $this->walkArithmeticPrimary($factor->arithmeticPrimary); |
|
2278
|
+ return $sign.$this->walkArithmeticPrimary($factor->arithmeticPrimary); |
2279
|
2279
|
} |
2280
|
2280
|
|
2281
|
2281
|
/** |
|
@@ -2288,7 +2288,7 @@ discard block |
|
|
block discarded – undo |
2288
|
2288
|
public function walkArithmeticPrimary($primary) |
2289
|
2289
|
{ |
2290
|
2290
|
if ($primary instanceof AST\SimpleArithmeticExpression) { |
2291
|
|
- return '(' . $this->walkSimpleArithmeticExpression($primary) . ')'; |
|
2291
|
+ return '('.$this->walkSimpleArithmeticExpression($primary).')'; |
2292
|
2292
|
} |
2293
|
2293
|
|
2294
|
2294
|
if ($primary instanceof AST\Node) { |
|
@@ -2352,6 +2352,6 @@ discard block |
|
|
block discarded – undo |
2352
|
2352
|
$sqlParameterList[] = $this->conn->quote($dis); |
2353
|
2353
|
} |
2354
|
2354
|
|
2355
|
|
- return '(' . implode(', ', $sqlParameterList) . ')'; |
|
2355
|
+ return '('.implode(', ', $sqlParameterList).')'; |
2356
|
2356
|
} |
2357
|
2357
|
} |