|
@@ -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
|
/** |
|
@@ -877,7 +877,7 @@ discard block |
|
|
block discarded – undo |
877
|
877
|
|
878
|
878
|
$assoc = $class->associationMappings[$fieldName]; |
879
|
879
|
|
880
|
|
- if (! $assoc['isOwningSide']) { |
|
880
|
+ if ( ! $assoc['isOwningSide']) { |
881
|
881
|
throw QueryException::associationPathInverseSideNotSupported($pathExpr); |
882
|
882
|
} |
883
|
883
|
|
|
@@ -931,7 +931,7 @@ discard block |
|
|
block discarded – undo |
931
|
931
|
} |
932
|
932
|
|
933
|
933
|
$sql = $this->platform->appendLockHint( |
934
|
|
- $this->quoteStrategy->getTableName($class, $this->platform) . ' ' . |
|
934
|
+ $this->quoteStrategy->getTableName($class, $this->platform).' '. |
935
|
935
|
$this->getSQLTableAlias($class->getTableName(), $dqlAlias), |
936
|
936
|
$this->query->getHint(Query::HINT_LOCK_MODE) |
937
|
937
|
); |
|
@@ -943,10 +943,10 @@ discard block |
|
|
block discarded – undo |
943
|
943
|
$classTableInheritanceJoins = $this->_generateClassTableInheritanceJoins($class, $dqlAlias); |
944
|
944
|
|
945
|
945
|
if ( ! $buildNestedJoins) { |
946
|
|
- return $sql . $classTableInheritanceJoins; |
|
946
|
+ return $sql.$classTableInheritanceJoins; |
947
|
947
|
} |
948
|
948
|
|
949
|
|
- return $classTableInheritanceJoins === '' ? $sql : '(' . $sql . $classTableInheritanceJoins . ')'; |
|
949
|
+ return $classTableInheritanceJoins === '' ? $sql : '('.$sql.$classTableInheritanceJoins.')'; |
950
|
950
|
} |
951
|
951
|
|
952
|
952
|
/** |
|
@@ -979,7 +979,7 @@ discard block |
|
|
block discarded – undo |
979
|
979
|
// Ensure we got the owning side, since it has all mapping info |
980
|
980
|
$assoc = ( ! $relation['isOwningSide']) ? $targetClass->associationMappings[$relation['mappedBy']] : $relation; |
981
|
981
|
|
982
|
|
- if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && (!$this->query->getHint(self::HINT_DISTINCT) || isset($this->selectedClasses[$joinedDqlAlias]))) { |
|
982
|
+ if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && ( ! $this->query->getHint(self::HINT_DISTINCT) || isset($this->selectedClasses[$joinedDqlAlias]))) { |
983
|
983
|
if ($relation['type'] == ClassMetadata::ONE_TO_MANY || $relation['type'] == ClassMetadata::MANY_TO_MANY) { |
984
|
984
|
throw QueryException::iterateWithFetchJoinNotAllowed($assoc); |
985
|
985
|
} |
|
@@ -999,12 +999,12 @@ discard block |
|
|
block discarded – undo |
999
|
999
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
1000
|
1000
|
|
1001
|
1001
|
if ($relation['isOwningSide']) { |
1002
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedSourceColumn . ' = ' . $targetTableAlias . '.' . $quotedTargetColumn; |
|
1002
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedSourceColumn.' = '.$targetTableAlias.'.'.$quotedTargetColumn; |
1003
|
1003
|
|
1004
|
1004
|
continue; |
1005
|
1005
|
} |
1006
|
1006
|
|
1007
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $targetTableAlias . '.' . $quotedSourceColumn; |
|
1007
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$targetTableAlias.'.'.$quotedSourceColumn; |
1008
|
1008
|
} |
1009
|
1009
|
|
1010
|
1010
|
// Apply remaining inheritance restrictions |
|
@@ -1022,7 +1022,7 @@ discard block |
|
|
block discarded – undo |
1022
|
1022
|
} |
1023
|
1023
|
|
1024
|
1024
|
$targetTableJoin = [ |
1025
|
|
- 'table' => $targetTableName . ' ' . $targetTableAlias, |
|
1025
|
+ 'table' => $targetTableName.' '.$targetTableAlias, |
1026
|
1026
|
'condition' => implode(' AND ', $conditions), |
1027
|
1027
|
]; |
1028
|
1028
|
break; |
|
@@ -1042,10 +1042,10 @@ discard block |
|
|
block discarded – undo |
1042
|
1042
|
$quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
1043
|
1043
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
1044
|
1044
|
|
1045
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
1045
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableAlias.'.'.$quotedSourceColumn; |
1046
|
1046
|
} |
1047
|
1047
|
|
1048
|
|
- $sql .= $joinTableName . ' ' . $joinTableAlias . ' ON ' . implode(' AND ', $conditions); |
|
1048
|
+ $sql .= $joinTableName.' '.$joinTableAlias.' ON '.implode(' AND ', $conditions); |
1049
|
1049
|
|
1050
|
1050
|
// Join target table |
1051
|
1051
|
$sql .= ($joinType == AST\Join::JOIN_TYPE_LEFT || $joinType == AST\Join::JOIN_TYPE_LEFTOUTER) ? ' LEFT JOIN ' : ' INNER JOIN '; |
|
@@ -1059,7 +1059,7 @@ discard block |
|
|
block discarded – undo |
1059
|
1059
|
$quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
1060
|
1060
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
1061
|
1061
|
|
1062
|
|
- $conditions[] = $targetTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
1062
|
+ $conditions[] = $targetTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableAlias.'.'.$quotedSourceColumn; |
1063
|
1063
|
} |
1064
|
1064
|
|
1065
|
1065
|
// Apply remaining inheritance restrictions |
|
@@ -1077,7 +1077,7 @@ discard block |
|
|
block discarded – undo |
1077
|
1077
|
} |
1078
|
1078
|
|
1079
|
1079
|
$targetTableJoin = [ |
1080
|
|
- 'table' => $targetTableName . ' ' . $targetTableAlias, |
|
1080
|
+ 'table' => $targetTableName.' '.$targetTableAlias, |
1081
|
1081
|
'condition' => implode(' AND ', $conditions), |
1082
|
1082
|
]; |
1083
|
1083
|
break; |
|
@@ -1087,22 +1087,22 @@ discard block |
|
|
block discarded – undo |
1087
|
1087
|
} |
1088
|
1088
|
|
1089
|
1089
|
// Handle WITH clause |
1090
|
|
- $withCondition = (null === $condExpr) ? '' : ('(' . $this->walkConditionalExpression($condExpr) . ')'); |
|
1090
|
+ $withCondition = (null === $condExpr) ? '' : ('('.$this->walkConditionalExpression($condExpr).')'); |
1091
|
1091
|
|
1092
|
1092
|
if ($targetClass->isInheritanceTypeJoined()) { |
1093
|
1093
|
$ctiJoins = $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias); |
1094
|
1094
|
// If we have WITH condition, we need to build nested joins for target class table and cti joins |
1095
|
1095
|
if ($withCondition) { |
1096
|
|
- $sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition']; |
|
1096
|
+ $sql .= '('.$targetTableJoin['table'].$ctiJoins.') ON '.$targetTableJoin['condition']; |
1097
|
1097
|
} else { |
1098
|
|
- $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'] . $ctiJoins; |
|
1098
|
+ $sql .= $targetTableJoin['table'].' ON '.$targetTableJoin['condition'].$ctiJoins; |
1099
|
1099
|
} |
1100
|
1100
|
} else { |
1101
|
|
- $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition']; |
|
1101
|
+ $sql .= $targetTableJoin['table'].' ON '.$targetTableJoin['condition']; |
1102
|
1102
|
} |
1103
|
1103
|
|
1104
|
1104
|
if ($withCondition) { |
1105
|
|
- $sql .= ' AND ' . $withCondition; |
|
1105
|
+ $sql .= ' AND '.$withCondition; |
1106
|
1106
|
} |
1107
|
1107
|
|
1108
|
1108
|
// Apply the indexes |
|
@@ -1135,7 +1135,7 @@ discard block |
|
|
block discarded – undo |
1135
|
1135
|
$orderByItems = array_merge($orderByItems, (array) $collectionOrderByItems); |
1136
|
1136
|
} |
1137
|
1137
|
|
1138
|
|
- return ' ORDER BY ' . implode(', ', $orderByItems); |
|
1138
|
+ return ' ORDER BY '.implode(', ', $orderByItems); |
1139
|
1139
|
} |
1140
|
1140
|
|
1141
|
1141
|
/** |
|
@@ -1152,10 +1152,10 @@ discard block |
|
|
block discarded – undo |
1152
|
1152
|
$this->orderedColumnsMap[$sql] = $type; |
1153
|
1153
|
|
1154
|
1154
|
if ($expr instanceof AST\Subselect) { |
1155
|
|
- return '(' . $sql . ') ' . $type; |
|
1155
|
+ return '('.$sql.') '.$type; |
1156
|
1156
|
} |
1157
|
1157
|
|
1158
|
|
- return $sql . ' ' . $type; |
|
1158
|
+ return $sql.' '.$type; |
1159
|
1159
|
} |
1160
|
1160
|
|
1161
|
1161
|
/** |
|
@@ -1163,7 +1163,7 @@ discard block |
|
|
block discarded – undo |
1163
|
1163
|
*/ |
1164
|
1164
|
public function walkHavingClause($havingClause) |
1165
|
1165
|
{ |
1166
|
|
- return ' HAVING ' . $this->walkConditionalExpression($havingClause->conditionalExpression); |
|
1166
|
+ return ' HAVING '.$this->walkConditionalExpression($havingClause->conditionalExpression); |
1167
|
1167
|
} |
1168
|
1168
|
|
1169
|
1169
|
/** |
|
@@ -1186,7 +1186,7 @@ discard block |
|
|
block discarded – undo |
1186
|
1186
|
$conditions = []; |
1187
|
1187
|
|
1188
|
1188
|
if ($join->conditionalExpression) { |
1189
|
|
- $conditions[] = '(' . $this->walkConditionalExpression($join->conditionalExpression) . ')'; |
|
1189
|
+ $conditions[] = '('.$this->walkConditionalExpression($join->conditionalExpression).')'; |
1190
|
1190
|
} |
1191
|
1191
|
|
1192
|
1192
|
$isUnconditionalJoin = empty($conditions); |
|
@@ -1194,7 +1194,7 @@ discard block |
|
|
block discarded – undo |
1194
|
1194
|
? ' AND ' |
1195
|
1195
|
: ' ON '; |
1196
|
1196
|
|
1197
|
|
- $sql .= $this->generateRangeVariableDeclarationSQL($joinDeclaration, !$isUnconditionalJoin); |
|
1197
|
+ $sql .= $this->generateRangeVariableDeclarationSQL($joinDeclaration, ! $isUnconditionalJoin); |
1198
|
1198
|
|
1199
|
1199
|
// Apply remaining inheritance restrictions |
1200
|
1200
|
$discrSql = $this->_generateDiscriminatorColumnConditionSQL([$dqlAlias]); |
|
@@ -1211,7 +1211,7 @@ discard block |
|
|
block discarded – undo |
1211
|
1211
|
} |
1212
|
1212
|
|
1213
|
1213
|
if ($conditions) { |
1214
|
|
- $sql .= $condExprConjunction . implode(' AND ', $conditions); |
|
1214
|
+ $sql .= $condExprConjunction.implode(' AND ', $conditions); |
1215
|
1215
|
} |
1216
|
1216
|
|
1217
|
1217
|
break; |
|
@@ -1241,7 +1241,7 @@ discard block |
|
|
block discarded – undo |
1241
|
1241
|
$scalarExpressions[] = $this->walkSimpleArithmeticExpression($scalarExpression); |
1242
|
1242
|
} |
1243
|
1243
|
|
1244
|
|
- $sql .= implode(', ', $scalarExpressions) . ')'; |
|
1244
|
+ $sql .= implode(', ', $scalarExpressions).')'; |
1245
|
1245
|
|
1246
|
1246
|
return $sql; |
1247
|
1247
|
} |
|
@@ -1263,7 +1263,7 @@ discard block |
|
|
block discarded – undo |
1263
|
1263
|
? $this->conn->quote($nullIfExpression->secondExpression) |
1264
|
1264
|
: $this->walkSimpleArithmeticExpression($nullIfExpression->secondExpression); |
1265
|
1265
|
|
1266
|
|
- return 'NULLIF(' . $firstExpression . ', ' . $secondExpression . ')'; |
|
1266
|
+ return 'NULLIF('.$firstExpression.', '.$secondExpression.')'; |
1267
|
1267
|
} |
1268
|
1268
|
|
1269
|
1269
|
/** |
|
@@ -1278,11 +1278,11 @@ discard block |
|
|
block discarded – undo |
1278
|
1278
|
$sql = 'CASE'; |
1279
|
1279
|
|
1280
|
1280
|
foreach ($generalCaseExpression->whenClauses as $whenClause) { |
1281
|
|
- $sql .= ' WHEN ' . $this->walkConditionalExpression($whenClause->caseConditionExpression); |
1282
|
|
- $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
|
1281
|
+ $sql .= ' WHEN '.$this->walkConditionalExpression($whenClause->caseConditionExpression); |
|
1282
|
+ $sql .= ' THEN '.$this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
1283
|
1283
|
} |
1284
|
1284
|
|
1285
|
|
- $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression) . ' END'; |
|
1285
|
+ $sql .= ' ELSE '.$this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression).' END'; |
1286
|
1286
|
|
1287
|
1287
|
return $sql; |
1288
|
1288
|
} |
|
@@ -1296,14 +1296,14 @@ discard block |
|
|
block discarded – undo |
1296
|
1296
|
*/ |
1297
|
1297
|
public function walkSimpleCaseExpression($simpleCaseExpression) |
1298
|
1298
|
{ |
1299
|
|
- $sql = 'CASE ' . $this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
|
1299
|
+ $sql = 'CASE '.$this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
1300
|
1300
|
|
1301
|
1301
|
foreach ($simpleCaseExpression->simpleWhenClauses as $simpleWhenClause) { |
1302
|
|
- $sql .= ' WHEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
1303
|
|
- $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
|
1302
|
+ $sql .= ' WHEN '.$this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
|
1303
|
+ $sql .= ' THEN '.$this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
1304
|
1304
|
} |
1305
|
1305
|
|
1306
|
|
- $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression) . ' END'; |
|
1306
|
+ $sql .= ' ELSE '.$this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression).' END'; |
1307
|
1307
|
|
1308
|
1308
|
return $sql; |
1309
|
1309
|
} |
|
@@ -1337,14 +1337,14 @@ discard block |
|
|
block discarded – undo |
1337
|
1337
|
$fieldMapping = $class->fieldMappings[$fieldName]; |
1338
|
1338
|
$columnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
1339
|
1339
|
$columnAlias = $this->getSQLColumnAlias($fieldMapping['columnName']); |
1340
|
|
- $col = $sqlTableAlias . '.' . $columnName; |
|
1340
|
+ $col = $sqlTableAlias.'.'.$columnName; |
1341
|
1341
|
|
1342
|
1342
|
if (isset($fieldMapping['requireSQLConversion'])) { |
1343
|
1343
|
$type = Type::getType($fieldMapping['type']); |
1344
|
1344
|
$col = $type->convertToPHPValueSQL($col, $this->conn->getDatabasePlatform()); |
1345
|
1345
|
} |
1346
|
1346
|
|
1347
|
|
- $sql .= $col . ' AS ' . $columnAlias; |
|
1347
|
+ $sql .= $col.' AS '.$columnAlias; |
1348
|
1348
|
|
1349
|
1349
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
1350
|
1350
|
|
|
@@ -1369,7 +1369,7 @@ discard block |
|
|
block discarded – undo |
1369
|
1369
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
1370
|
1370
|
$resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
1371
|
1371
|
|
1372
|
|
- $sql .= $expr->dispatch($this) . ' AS ' . $columnAlias; |
|
1372
|
+ $sql .= $expr->dispatch($this).' AS '.$columnAlias; |
1373
|
1373
|
|
1374
|
1374
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
1375
|
1375
|
|
|
@@ -1383,7 +1383,7 @@ discard block |
|
|
block discarded – undo |
1383
|
1383
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
1384
|
1384
|
$resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
1385
|
1385
|
|
1386
|
|
- $sql .= '(' . $this->walkSubselect($expr) . ') AS ' . $columnAlias; |
|
1386
|
+ $sql .= '('.$this->walkSubselect($expr).') AS '.$columnAlias; |
1387
|
1387
|
|
1388
|
1388
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
1389
|
1389
|
|
|
@@ -1394,7 +1394,7 @@ discard block |
|
|
block discarded – undo |
1394
|
1394
|
break; |
1395
|
1395
|
|
1396
|
1396
|
case ($expr instanceof AST\NewObjectExpression): |
1397
|
|
- $sql .= $this->walkNewObject($expr,$selectExpression->fieldIdentificationVariable); |
|
1397
|
+ $sql .= $this->walkNewObject($expr, $selectExpression->fieldIdentificationVariable); |
1398
|
1398
|
break; |
1399
|
1399
|
|
1400
|
1400
|
default: |
|
@@ -1435,14 +1435,14 @@ discard block |
|
|
block discarded – undo |
1435
|
1435
|
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
1436
|
1436
|
$quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
1437
|
1437
|
|
1438
|
|
- $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
1438
|
+ $col = $sqlTableAlias.'.'.$quotedColumnName; |
1439
|
1439
|
|
1440
|
1440
|
if (isset($mapping['requireSQLConversion'])) { |
1441
|
1441
|
$type = Type::getType($mapping['type']); |
1442
|
1442
|
$col = $type->convertToPHPValueSQL($col, $this->platform); |
1443
|
1443
|
} |
1444
|
1444
|
|
1445
|
|
- $sqlParts[] = $col . ' AS '. $columnAlias; |
|
1445
|
+ $sqlParts[] = $col.' AS '.$columnAlias; |
1446
|
1446
|
|
1447
|
1447
|
$this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
1448
|
1448
|
|
|
@@ -1459,21 +1459,21 @@ discard block |
|
|
block discarded – undo |
1459
|
1459
|
$sqlTableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias); |
1460
|
1460
|
|
1461
|
1461
|
foreach ($subClass->fieldMappings as $fieldName => $mapping) { |
1462
|
|
- if (isset($mapping['inherited']) || ($partialFieldSet && !in_array($fieldName, $partialFieldSet))) { |
|
1462
|
+ if (isset($mapping['inherited']) || ($partialFieldSet && ! in_array($fieldName, $partialFieldSet))) { |
1463
|
1463
|
continue; |
1464
|
1464
|
} |
1465
|
1465
|
|
1466
|
1466
|
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
1467
|
1467
|
$quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $subClass, $this->platform); |
1468
|
1468
|
|
1469
|
|
- $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
1469
|
+ $col = $sqlTableAlias.'.'.$quotedColumnName; |
1470
|
1470
|
|
1471
|
1471
|
if (isset($mapping['requireSQLConversion'])) { |
1472
|
1472
|
$type = Type::getType($mapping['type']); |
1473
|
1473
|
$col = $type->convertToPHPValueSQL($col, $this->platform); |
1474
|
1474
|
} |
1475
|
1475
|
|
1476
|
|
- $sqlParts[] = $col . ' AS ' . $columnAlias; |
|
1476
|
+ $sqlParts[] = $col.' AS '.$columnAlias; |
1477
|
1477
|
|
1478
|
1478
|
$this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
1479
|
1479
|
|
|
@@ -1493,7 +1493,7 @@ discard block |
|
|
block discarded – undo |
1493
|
1493
|
*/ |
1494
|
1494
|
public function walkQuantifiedExpression($qExpr) |
1495
|
1495
|
{ |
1496
|
|
- return ' ' . strtoupper($qExpr->type) . '(' . $this->walkSubselect($qExpr->subselect) . ')'; |
|
1496
|
+ return ' '.strtoupper($qExpr->type).'('.$this->walkSubselect($qExpr->subselect).')'; |
1497
|
1497
|
} |
1498
|
1498
|
|
1499
|
1499
|
/** |
|
@@ -1533,7 +1533,7 @@ discard block |
|
|
block discarded – undo |
1533
|
1533
|
$sqlParts[] = $this->walkIdentificationVariableDeclaration($subselectIdVarDecl); |
1534
|
1534
|
} |
1535
|
1535
|
|
1536
|
|
- return ' FROM ' . implode(', ', $sqlParts); |
|
1536
|
+ return ' FROM '.implode(', ', $sqlParts); |
1537
|
1537
|
} |
1538
|
1538
|
|
1539
|
1539
|
/** |
|
@@ -1541,7 +1541,7 @@ discard block |
|
|
block discarded – undo |
1541
|
1541
|
*/ |
1542
|
1542
|
public function walkSimpleSelectClause($simpleSelectClause) |
1543
|
1543
|
{ |
1544
|
|
- return 'SELECT' . ($simpleSelectClause->isDistinct ? ' DISTINCT' : '') |
|
1544
|
+ return 'SELECT'.($simpleSelectClause->isDistinct ? ' DISTINCT' : '') |
1545
|
1545
|
. $this->walkSimpleSelectExpression($simpleSelectClause->simpleSelectExpression); |
1546
|
1546
|
} |
1547
|
1547
|
|
|
@@ -1560,10 +1560,10 @@ discard block |
|
|
block discarded – undo |
1560
|
1560
|
* @param null|string $newObjectResultAlias |
1561
|
1561
|
* @return string The SQL. |
1562
|
1562
|
*/ |
1563
|
|
- public function walkNewObject($newObjectExpression, $newObjectResultAlias=null) |
|
1563
|
+ public function walkNewObject($newObjectExpression, $newObjectResultAlias = null) |
1564
|
1564
|
{ |
1565
|
1565
|
$sqlSelectExpressions = []; |
1566
|
|
- $objIndex = $newObjectResultAlias?:$this->newObjectCounter++; |
|
1566
|
+ $objIndex = $newObjectResultAlias ?: $this->newObjectCounter++; |
1567
|
1567
|
|
1568
|
1568
|
foreach ($newObjectExpression->args as $argIndex => $e) { |
1569
|
1569
|
$resultAlias = $this->scalarResultCounter++; |
|
@@ -1576,7 +1576,7 @@ discard block |
|
|
block discarded – undo |
1576
|
1576
|
break; |
1577
|
1577
|
|
1578
|
1578
|
case ($e instanceof AST\Subselect): |
1579
|
|
- $sqlSelectExpressions[] = '(' . $e->dispatch($this) . ') AS ' . $columnAlias; |
|
1579
|
+ $sqlSelectExpressions[] = '('.$e->dispatch($this).') AS '.$columnAlias; |
1580
|
1580
|
break; |
1581
|
1581
|
|
1582
|
1582
|
case ($e instanceof AST\PathExpression): |
|
@@ -1585,7 +1585,7 @@ discard block |
|
|
block discarded – undo |
1585
|
1585
|
$class = $qComp['metadata']; |
1586
|
1586
|
$fieldType = $class->fieldMappings[$e->field]['type']; |
1587
|
1587
|
|
1588
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
1588
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
1589
|
1589
|
break; |
1590
|
1590
|
|
1591
|
1591
|
case ($e instanceof AST\Literal): |
|
@@ -1599,11 +1599,11 @@ discard block |
|
|
block discarded – undo |
1599
|
1599
|
break; |
1600
|
1600
|
} |
1601
|
1601
|
|
1602
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
1602
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
1603
|
1603
|
break; |
1604
|
1604
|
|
1605
|
1605
|
default: |
1606
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
1606
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
1607
|
1607
|
break; |
1608
|
1608
|
} |
1609
|
1609
|
|
|
@@ -1636,10 +1636,10 @@ discard block |
|
|
block discarded – undo |
1636
|
1636
|
case ($expr instanceof AST\Subselect): |
1637
|
1637
|
$alias = $simpleSelectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
1638
|
1638
|
|
1639
|
|
- $columnAlias = 'sclr' . $this->aliasCounter++; |
|
1639
|
+ $columnAlias = 'sclr'.$this->aliasCounter++; |
1640
|
1640
|
$this->scalarResultAliasMap[$alias] = $columnAlias; |
1641
|
1641
|
|
1642
|
|
- $sql .= '(' . $this->walkSubselect($expr) . ') AS ' . $columnAlias; |
|
1642
|
+ $sql .= '('.$this->walkSubselect($expr).') AS '.$columnAlias; |
1643
|
1643
|
break; |
1644
|
1644
|
|
1645
|
1645
|
case ($expr instanceof AST\Functions\FunctionNode): |
|
@@ -1656,7 +1656,7 @@ discard block |
|
|
block discarded – undo |
1656
|
1656
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
1657
|
1657
|
$this->scalarResultAliasMap[$alias] = $columnAlias; |
1658
|
1658
|
|
1659
|
|
- $sql .= $expr->dispatch($this) . ' AS ' . $columnAlias; |
|
1659
|
+ $sql .= $expr->dispatch($this).' AS '.$columnAlias; |
1660
|
1660
|
break; |
1661
|
1661
|
|
1662
|
1662
|
case ($expr instanceof AST\ParenthesisExpression): |
|
@@ -1676,8 +1676,8 @@ discard block |
|
|
block discarded – undo |
1676
|
1676
|
*/ |
1677
|
1677
|
public function walkAggregateExpression($aggExpression) |
1678
|
1678
|
{ |
1679
|
|
- return $aggExpression->functionName . '(' . ($aggExpression->isDistinct ? 'DISTINCT ' : '') |
1680
|
|
- . $this->walkSimpleArithmeticExpression($aggExpression->pathExpression) . ')'; |
|
1679
|
+ return $aggExpression->functionName.'('.($aggExpression->isDistinct ? 'DISTINCT ' : '') |
|
1680
|
+ . $this->walkSimpleArithmeticExpression($aggExpression->pathExpression).')'; |
1681
|
1681
|
} |
1682
|
1682
|
|
1683
|
1683
|
/** |
|
@@ -1691,7 +1691,7 @@ discard block |
|
|
block discarded – undo |
1691
|
1691
|
$sqlParts[] = $this->walkGroupByItem($groupByItem); |
1692
|
1692
|
} |
1693
|
1693
|
|
1694
|
|
- return ' GROUP BY ' . implode(', ', $sqlParts); |
|
1694
|
+ return ' GROUP BY '.implode(', ', $sqlParts); |
1695
|
1695
|
} |
1696
|
1696
|
|
1697
|
1697
|
/** |
|
@@ -1748,7 +1748,7 @@ discard block |
|
|
block discarded – undo |
1748
|
1748
|
{ |
1749
|
1749
|
$class = $this->em->getClassMetadata($deleteClause->abstractSchemaName); |
1750
|
1750
|
$tableName = $class->getTableName(); |
1751
|
|
- $sql = 'DELETE FROM ' . $this->quoteStrategy->getTableName($class, $this->platform); |
|
1751
|
+ $sql = 'DELETE FROM '.$this->quoteStrategy->getTableName($class, $this->platform); |
1752
|
1752
|
|
1753
|
1753
|
$this->setSQLTableAlias($tableName, $tableName, $deleteClause->aliasIdentificationVariable); |
1754
|
1754
|
$this->rootAliases[] = $deleteClause->aliasIdentificationVariable; |
|
@@ -1763,12 +1763,12 @@ discard block |
|
|
block discarded – undo |
1763
|
1763
|
{ |
1764
|
1764
|
$class = $this->em->getClassMetadata($updateClause->abstractSchemaName); |
1765
|
1765
|
$tableName = $class->getTableName(); |
1766
|
|
- $sql = 'UPDATE ' . $this->quoteStrategy->getTableName($class, $this->platform); |
|
1766
|
+ $sql = 'UPDATE '.$this->quoteStrategy->getTableName($class, $this->platform); |
1767
|
1767
|
|
1768
|
1768
|
$this->setSQLTableAlias($tableName, $tableName, $updateClause->aliasIdentificationVariable); |
1769
|
1769
|
$this->rootAliases[] = $updateClause->aliasIdentificationVariable; |
1770
|
1770
|
|
1771
|
|
- $sql .= ' SET ' . implode(', ', array_map([$this, 'walkUpdateItem'], $updateClause->updateItems)); |
|
1771
|
+ $sql .= ' SET '.implode(', ', array_map([$this, 'walkUpdateItem'], $updateClause->updateItems)); |
1772
|
1772
|
|
1773
|
1773
|
return $sql; |
1774
|
1774
|
} |
|
@@ -1781,7 +1781,7 @@ discard block |
|
|
block discarded – undo |
1781
|
1781
|
$useTableAliasesBefore = $this->useSqlTableAliases; |
1782
|
1782
|
$this->useSqlTableAliases = false; |
1783
|
1783
|
|
1784
|
|
- $sql = $this->walkPathExpression($updateItem->pathExpression) . ' = '; |
|
1784
|
+ $sql = $this->walkPathExpression($updateItem->pathExpression).' = '; |
1785
|
1785
|
$newValue = $updateItem->newValue; |
1786
|
1786
|
|
1787
|
1787
|
switch (true) { |
|
@@ -1824,7 +1824,7 @@ discard block |
|
|
block discarded – undo |
1824
|
1824
|
|
1825
|
1825
|
if (count($filterClauses)) { |
1826
|
1826
|
if ($condSql) { |
1827
|
|
- $condSql = '(' . $condSql . ') AND '; |
|
1827
|
+ $condSql = '('.$condSql.') AND '; |
1828
|
1828
|
} |
1829
|
1829
|
|
1830
|
1830
|
$condSql .= implode(' AND ', $filterClauses); |
|
@@ -1832,11 +1832,11 @@ discard block |
|
|
block discarded – undo |
1832
|
1832
|
} |
1833
|
1833
|
|
1834
|
1834
|
if ($condSql) { |
1835
|
|
- return ' WHERE ' . (( ! $discrSql) ? $condSql : '(' . $condSql . ') AND ' . $discrSql); |
|
1835
|
+ return ' WHERE '.(( ! $discrSql) ? $condSql : '('.$condSql.') AND '.$discrSql); |
1836
|
1836
|
} |
1837
|
1837
|
|
1838
|
1838
|
if ($discrSql) { |
1839
|
|
- return ' WHERE ' . $discrSql; |
|
1839
|
+ return ' WHERE '.$discrSql; |
1840
|
1840
|
} |
1841
|
1841
|
|
1842
|
1842
|
return ''; |
|
@@ -1879,7 +1879,7 @@ discard block |
|
|
block discarded – undo |
1879
|
1879
|
// if only one ConditionalPrimary is defined |
1880
|
1880
|
return ( ! ($factor instanceof AST\ConditionalFactor)) |
1881
|
1881
|
? $this->walkConditionalPrimary($factor) |
1882
|
|
- : ($factor->not ? 'NOT ' : '') . $this->walkConditionalPrimary($factor->conditionalPrimary); |
|
1882
|
+ : ($factor->not ? 'NOT ' : '').$this->walkConditionalPrimary($factor->conditionalPrimary); |
1883
|
1883
|
} |
1884
|
1884
|
|
1885
|
1885
|
/** |
|
@@ -1894,7 +1894,7 @@ discard block |
|
|
block discarded – undo |
1894
|
1894
|
if ($primary->isConditionalExpression()) { |
1895
|
1895
|
$condExpr = $primary->conditionalExpression; |
1896
|
1896
|
|
1897
|
|
- return '(' . $this->walkConditionalExpression($condExpr) . ')'; |
|
1897
|
+ return '('.$this->walkConditionalExpression($condExpr).')'; |
1898
|
1898
|
} |
1899
|
1899
|
} |
1900
|
1900
|
|
|
@@ -1905,7 +1905,7 @@ discard block |
|
|
block discarded – undo |
1905
|
1905
|
{ |
1906
|
1906
|
$sql = ($existsExpr->not) ? 'NOT ' : ''; |
1907
|
1907
|
|
1908
|
|
- $sql .= 'EXISTS (' . $this->walkSubselect($existsExpr->subselect) . ')'; |
|
1908
|
+ $sql .= 'EXISTS ('.$this->walkSubselect($existsExpr->subselect).')'; |
1909
|
1909
|
|
1910
|
1910
|
return $sql; |
1911
|
1911
|
} |
|
@@ -1949,7 +1949,7 @@ discard block |
|
|
block discarded – undo |
1949
|
1949
|
$targetTableAlias = $this->getSQLTableAlias($targetClass->getTableName()); |
1950
|
1950
|
$sourceTableAlias = $this->getSQLTableAlias($class->getTableName(), $dqlAlias); |
1951
|
1951
|
|
1952
|
|
- $sql .= $this->quoteStrategy->getTableName($targetClass, $this->platform) . ' ' . $targetTableAlias . ' WHERE '; |
|
1952
|
+ $sql .= $this->quoteStrategy->getTableName($targetClass, $this->platform).' '.$targetTableAlias.' WHERE '; |
1953
|
1953
|
|
1954
|
1954
|
$owningAssoc = $targetClass->associationMappings[$assoc['mappedBy']]; |
1955
|
1955
|
$sqlParts = []; |
|
@@ -1957,7 +1957,7 @@ discard block |
|
|
block discarded – undo |
1957
|
1957
|
foreach ($owningAssoc['targetToSourceKeyColumns'] as $targetColumn => $sourceColumn) { |
1958
|
1958
|
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$targetColumn], $class, $this->platform); |
1959
|
1959
|
|
1960
|
|
- $sqlParts[] = $sourceTableAlias . '.' . $targetColumn . ' = ' . $targetTableAlias . '.' . $sourceColumn; |
|
1960
|
+ $sqlParts[] = $sourceTableAlias.'.'.$targetColumn.' = '.$targetTableAlias.'.'.$sourceColumn; |
1961
|
1961
|
} |
1962
|
1962
|
|
1963
|
1963
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($targetClass, $this->platform) as $targetColumnName) { |
|
@@ -1965,7 +1965,7 @@ discard block |
|
|
block discarded – undo |
1965
|
1965
|
$this->parserResult->addParameterMapping($dqlParamKey, $this->sqlParamIndex++); |
1966
|
1966
|
} |
1967
|
1967
|
|
1968
|
|
- $sqlParts[] = $targetTableAlias . '.' . $targetColumnName . ' = ' . $entitySql; |
|
1968
|
+ $sqlParts[] = $targetTableAlias.'.'.$targetColumnName.' = '.$entitySql; |
1969
|
1969
|
} |
1970
|
1970
|
|
1971
|
1971
|
$sql .= implode(' AND ', $sqlParts); |
|
@@ -1981,8 +1981,8 @@ discard block |
|
|
block discarded – undo |
1981
|
1981
|
$sourceTableAlias = $this->getSQLTableAlias($class->getTableName(), $dqlAlias); |
1982
|
1982
|
|
1983
|
1983
|
// join to target table |
1984
|
|
- $sql .= $this->quoteStrategy->getJoinTableName($owningAssoc, $targetClass, $this->platform) . ' ' . $joinTableAlias |
1985
|
|
- . ' INNER JOIN ' . $this->quoteStrategy->getTableName($targetClass, $this->platform) . ' ' . $targetTableAlias . ' ON '; |
|
1984
|
+ $sql .= $this->quoteStrategy->getJoinTableName($owningAssoc, $targetClass, $this->platform).' '.$joinTableAlias |
|
1985
|
+ . ' INNER JOIN '.$this->quoteStrategy->getTableName($targetClass, $this->platform).' '.$targetTableAlias.' ON '; |
1986
|
1986
|
|
1987
|
1987
|
// join conditions |
1988
|
1988
|
$joinColumns = $assoc['isOwningSide'] ? $joinTable['inverseJoinColumns'] : $joinTable['joinColumns']; |
|
@@ -1991,7 +1991,7 @@ discard block |
|
|
block discarded – undo |
1991
|
1991
|
foreach ($joinColumns as $joinColumn) { |
1992
|
1992
|
$targetColumn = $this->quoteStrategy->getColumnName($targetClass->fieldNames[$joinColumn['referencedColumnName']], $targetClass, $this->platform); |
1993
|
1993
|
|
1994
|
|
- $joinSqlParts[] = $joinTableAlias . '.' . $joinColumn['name'] . ' = ' . $targetTableAlias . '.' . $targetColumn; |
|
1994
|
+ $joinSqlParts[] = $joinTableAlias.'.'.$joinColumn['name'].' = '.$targetTableAlias.'.'.$targetColumn; |
1995
|
1995
|
} |
1996
|
1996
|
|
1997
|
1997
|
$sql .= implode(' AND ', $joinSqlParts); |
|
@@ -2003,7 +2003,7 @@ discard block |
|
|
block discarded – undo |
2003
|
2003
|
foreach ($joinColumns as $joinColumn) { |
2004
|
2004
|
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$joinColumn['referencedColumnName']], $class, $this->platform); |
2005
|
2005
|
|
2006
|
|
- $sqlParts[] = $joinTableAlias . '.' . $joinColumn['name'] . ' = ' . $sourceTableAlias . '.' . $targetColumn; |
|
2006
|
+ $sqlParts[] = $joinTableAlias.'.'.$joinColumn['name'].' = '.$sourceTableAlias.'.'.$targetColumn; |
2007
|
2007
|
} |
2008
|
2008
|
|
2009
|
2009
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($targetClass, $this->platform) as $targetColumnName) { |
|
@@ -2011,13 +2011,13 @@ discard block |
|
|
block discarded – undo |
2011
|
2011
|
$this->parserResult->addParameterMapping($dqlParamKey, $this->sqlParamIndex++); |
2012
|
2012
|
} |
2013
|
2013
|
|
2014
|
|
- $sqlParts[] = $targetTableAlias . '.' . $targetColumnName . ' IN (' . $entitySql . ')'; |
|
2014
|
+ $sqlParts[] = $targetTableAlias.'.'.$targetColumnName.' IN ('.$entitySql.')'; |
2015
|
2015
|
} |
2016
|
2016
|
|
2017
|
2017
|
$sql .= implode(' AND ', $sqlParts); |
2018
|
2018
|
} |
2019
|
2019
|
|
2020
|
|
- return $sql . ')'; |
|
2020
|
+ return $sql.')'; |
2021
|
2021
|
} |
2022
|
2022
|
|
2023
|
2023
|
/** |
|
@@ -2028,7 +2028,7 @@ discard block |
|
|
block discarded – undo |
2028
|
2028
|
$sizeFunc = new AST\Functions\SizeFunction('size'); |
2029
|
2029
|
$sizeFunc->collectionPathExpression = $emptyCollCompExpr->expression; |
2030
|
2030
|
|
2031
|
|
- return $sizeFunc->getSql($this) . ($emptyCollCompExpr->not ? ' > 0' : ' = 0'); |
|
2031
|
+ return $sizeFunc->getSql($this).($emptyCollCompExpr->not ? ' > 0' : ' = 0'); |
2032
|
2032
|
} |
2033
|
2033
|
|
2034
|
2034
|
/** |
|
@@ -2037,19 +2037,19 @@ discard block |
|
|
block discarded – undo |
2037
|
2037
|
public function walkNullComparisonExpression($nullCompExpr) |
2038
|
2038
|
{ |
2039
|
2039
|
$expression = $nullCompExpr->expression; |
2040
|
|
- $comparison = ' IS' . ($nullCompExpr->not ? ' NOT' : '') . ' NULL'; |
|
2040
|
+ $comparison = ' IS'.($nullCompExpr->not ? ' NOT' : '').' NULL'; |
2041
|
2041
|
|
2042
|
2042
|
// Handle ResultVariable |
2043
|
2043
|
if (is_string($expression) && isset($this->queryComponents[$expression]['resultVariable'])) { |
2044
|
|
- return $this->walkResultVariable($expression) . $comparison; |
|
2044
|
+ return $this->walkResultVariable($expression).$comparison; |
2045
|
2045
|
} |
2046
|
2046
|
|
2047
|
2047
|
// Handle InputParameter mapping inclusion to ParserResult |
2048
|
2048
|
if ($expression instanceof AST\InputParameter) { |
2049
|
|
- return $this->walkInputParameter($expression) . $comparison; |
|
2049
|
+ return $this->walkInputParameter($expression).$comparison; |
2050
|
2050
|
} |
2051
|
2051
|
|
2052
|
|
- return $expression->dispatch($this) . $comparison; |
|
2052
|
+ return $expression->dispatch($this).$comparison; |
2053
|
2053
|
} |
2054
|
2054
|
|
2055
|
2055
|
/** |
|
@@ -2057,7 +2057,7 @@ discard block |
|
|
block discarded – undo |
2057
|
2057
|
*/ |
2058
|
2058
|
public function walkInExpression($inExpr) |
2059
|
2059
|
{ |
2060
|
|
- $sql = $this->walkArithmeticExpression($inExpr->expression) . ($inExpr->not ? ' NOT' : '') . ' IN ('; |
|
2060
|
+ $sql = $this->walkArithmeticExpression($inExpr->expression).($inExpr->not ? ' NOT' : '').' IN ('; |
2061
|
2061
|
|
2062
|
2062
|
$sql .= ($inExpr->subselect) |
2063
|
2063
|
? $this->walkSubselect($inExpr->subselect) |
|
@@ -2084,10 +2084,10 @@ discard block |
|
|
block discarded – undo |
2084
|
2084
|
} |
2085
|
2085
|
|
2086
|
2086
|
if ($this->useSqlTableAliases) { |
2087
|
|
- $sql .= $this->getSQLTableAlias($discrClass->getTableName(), $dqlAlias) . '.'; |
|
2087
|
+ $sql .= $this->getSQLTableAlias($discrClass->getTableName(), $dqlAlias).'.'; |
2088
|
2088
|
} |
2089
|
2089
|
|
2090
|
|
- $sql .= $class->discriminatorColumn['name'] . ($instanceOfExpr->not ? ' NOT IN ' : ' IN '); |
|
2090
|
+ $sql .= $class->discriminatorColumn['name'].($instanceOfExpr->not ? ' NOT IN ' : ' IN '); |
2091
|
2091
|
$sql .= $this->getChildDiscriminatorsFromClassMetadata($discrClass, $instanceOfExpr); |
2092
|
2092
|
|
2093
|
2093
|
return $sql; |
|
@@ -2134,8 +2134,8 @@ discard block |
|
|
block discarded – undo |
2134
|
2134
|
$sql .= ' NOT'; |
2135
|
2135
|
} |
2136
|
2136
|
|
2137
|
|
- $sql .= ' BETWEEN ' . $this->walkArithmeticExpression($betweenExpr->leftBetweenExpression) |
2138
|
|
- . ' AND ' . $this->walkArithmeticExpression($betweenExpr->rightBetweenExpression); |
|
2137
|
+ $sql .= ' BETWEEN '.$this->walkArithmeticExpression($betweenExpr->leftBetweenExpression) |
|
2138
|
+ . ' AND '.$this->walkArithmeticExpression($betweenExpr->rightBetweenExpression); |
2139
|
2139
|
|
2140
|
2140
|
return $sql; |
2141
|
2141
|
} |
|
@@ -2150,7 +2150,7 @@ discard block |
|
|
block discarded – undo |
2150
|
2150
|
? $this->walkResultVariable($stringExpr) |
2151
|
2151
|
: $stringExpr->dispatch($this); |
2152
|
2152
|
|
2153
|
|
- $sql = $leftExpr . ($likeExpr->not ? ' NOT' : '') . ' LIKE '; |
|
2153
|
+ $sql = $leftExpr.($likeExpr->not ? ' NOT' : '').' LIKE '; |
2154
|
2154
|
|
2155
|
2155
|
if ($likeExpr->stringPattern instanceof AST\InputParameter) { |
2156
|
2156
|
$sql .= $this->walkInputParameter($likeExpr->stringPattern); |
|
@@ -2163,7 +2163,7 @@ discard block |
|
|
block discarded – undo |
2163
|
2163
|
} |
2164
|
2164
|
|
2165
|
2165
|
if ($likeExpr->escapeChar) { |
2166
|
|
- $sql .= ' ESCAPE ' . $this->walkLiteral($likeExpr->escapeChar); |
|
2166
|
+ $sql .= ' ESCAPE '.$this->walkLiteral($likeExpr->escapeChar); |
2167
|
2167
|
} |
2168
|
2168
|
|
2169
|
2169
|
return $sql; |
|
@@ -2190,7 +2190,7 @@ discard block |
|
|
block discarded – undo |
2190
|
2190
|
? $leftExpr->dispatch($this) |
2191
|
2191
|
: (is_numeric($leftExpr) ? $leftExpr : $this->conn->quote($leftExpr)); |
2192
|
2192
|
|
2193
|
|
- $sql .= ' ' . $compExpr->operator . ' '; |
|
2193
|
+ $sql .= ' '.$compExpr->operator.' '; |
2194
|
2194
|
|
2195
|
2195
|
$sql .= ($rightExpr instanceof AST\Node) |
2196
|
2196
|
? $rightExpr->dispatch($this) |
|
@@ -2222,7 +2222,7 @@ discard block |
|
|
block discarded – undo |
2222
|
2222
|
{ |
2223
|
2223
|
return ($arithmeticExpr->isSimpleArithmeticExpression()) |
2224
|
2224
|
? $this->walkSimpleArithmeticExpression($arithmeticExpr->simpleArithmeticExpression) |
2225
|
|
- : '(' . $this->walkSubselect($arithmeticExpr->subselect) . ')'; |
|
2225
|
+ : '('.$this->walkSubselect($arithmeticExpr->subselect).')'; |
2226
|
2226
|
} |
2227
|
2227
|
|
2228
|
2228
|
/** |
|
@@ -2276,7 +2276,7 @@ discard block |
|
|
block discarded – undo |
2276
|
2276
|
|
2277
|
2277
|
$sign = $factor->isNegativeSigned() ? '-' : ($factor->isPositiveSigned() ? '+' : ''); |
2278
|
2278
|
|
2279
|
|
- return $sign . $this->walkArithmeticPrimary($factor->arithmeticPrimary); |
|
2279
|
+ return $sign.$this->walkArithmeticPrimary($factor->arithmeticPrimary); |
2280
|
2280
|
} |
2281
|
2281
|
|
2282
|
2282
|
/** |
|
@@ -2289,7 +2289,7 @@ discard block |
|
|
block discarded – undo |
2289
|
2289
|
public function walkArithmeticPrimary($primary) |
2290
|
2290
|
{ |
2291
|
2291
|
if ($primary instanceof AST\SimpleArithmeticExpression) { |
2292
|
|
- return '(' . $this->walkSimpleArithmeticExpression($primary) . ')'; |
|
2292
|
+ return '('.$this->walkSimpleArithmeticExpression($primary).')'; |
2293
|
2293
|
} |
2294
|
2294
|
|
2295
|
2295
|
if ($primary instanceof AST\Node) { |
|
@@ -2353,6 +2353,6 @@ discard block |
|
|
block discarded – undo |
2353
|
2353
|
$sqlParameterList[] = $this->conn->quote($dis); |
2354
|
2354
|
} |
2355
|
2355
|
|
2356
|
|
- return '(' . implode(', ', $sqlParameterList) . ')'; |
|
2356
|
+ return '('.implode(', ', $sqlParameterList).')'; |
2357
|
2357
|
} |
2358
|
2358
|
} |