|
@@ -289,11 +289,11 @@ discard block |
|
|
block discarded – undo |
289
|
289
|
*/ |
290
|
290
|
public function getSQLTableAlias($tableName, $dqlAlias = '') |
291
|
291
|
{ |
292
|
|
- $tableName .= ($dqlAlias) ? '@[' . $dqlAlias . ']' : ''; |
|
292
|
+ $tableName .= ($dqlAlias) ? '@['.$dqlAlias.']' : ''; |
293
|
293
|
|
294
|
294
|
if ( ! isset($this->tableAliasMap[$tableName])) { |
295
|
295
|
$this->tableAliasMap[$tableName] = (preg_match('/[a-z]/i', $tableName[0]) ? strtolower($tableName[0]) : 't') |
296
|
|
- . $this->tableAliasCounter++ . '_'; |
|
296
|
+ . $this->tableAliasCounter++.'_'; |
297
|
297
|
} |
298
|
298
|
|
299
|
299
|
return $this->tableAliasMap[$tableName]; |
|
@@ -311,7 +311,7 @@ discard block |
|
|
block discarded – undo |
311
|
311
|
*/ |
312
|
312
|
public function setSQLTableAlias($tableName, $alias, $dqlAlias = '') |
313
|
313
|
{ |
314
|
|
- $tableName .= ($dqlAlias) ? '@[' . $dqlAlias . ']' : ''; |
|
314
|
+ $tableName .= ($dqlAlias) ? '@['.$dqlAlias.']' : ''; |
315
|
315
|
|
316
|
316
|
$this->tableAliasMap[$tableName] = $alias; |
317
|
317
|
|
|
@@ -352,12 +352,12 @@ discard block |
|
|
block discarded – undo |
352
|
352
|
|
353
|
353
|
// If this is a joined association we must use left joins to preserve the correct result. |
354
|
354
|
$sql .= isset($this->queryComponents[$dqlAlias]['relation']) ? ' LEFT ' : ' INNER '; |
355
|
|
- $sql .= 'JOIN ' . $this->quoteStrategy->getTableName($parentClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
355
|
+ $sql .= 'JOIN '.$this->quoteStrategy->getTableName($parentClass, $this->platform).' '.$tableAlias.' ON '; |
356
|
356
|
|
357
|
357
|
$sqlParts = []; |
358
|
358
|
|
359
|
359
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($class, $this->platform) as $columnName) { |
360
|
|
- $sqlParts[] = $baseTableAlias . '.' . $columnName . ' = ' . $tableAlias . '.' . $columnName; |
|
360
|
+ $sqlParts[] = $baseTableAlias.'.'.$columnName.' = '.$tableAlias.'.'.$columnName; |
361
|
361
|
} |
362
|
362
|
|
363
|
363
|
// Add filters on the root class |
|
@@ -378,12 +378,12 @@ discard block |
|
|
block discarded – undo |
378
|
378
|
$subClass = $this->em->getClassMetadata($subClassName); |
379
|
379
|
$tableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias); |
380
|
380
|
|
381
|
|
- $sql .= ' LEFT JOIN ' . $this->quoteStrategy->getTableName($subClass, $this->platform) . ' ' . $tableAlias . ' ON '; |
|
381
|
+ $sql .= ' LEFT JOIN '.$this->quoteStrategy->getTableName($subClass, $this->platform).' '.$tableAlias.' ON '; |
382
|
382
|
|
383
|
383
|
$sqlParts = []; |
384
|
384
|
|
385
|
385
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($subClass, $this->platform) as $columnName) { |
386
|
|
- $sqlParts[] = $baseTableAlias . '.' . $columnName . ' = ' . $tableAlias . '.' . $columnName; |
|
386
|
+ $sqlParts[] = $baseTableAlias.'.'.$columnName.' = '.$tableAlias.'.'.$columnName; |
387
|
387
|
} |
388
|
388
|
|
389
|
389
|
$sql .= implode(' AND ', $sqlParts); |
|
@@ -415,7 +415,7 @@ discard block |
|
|
block discarded – undo |
415
|
415
|
? $persister->getOwningTable($fieldName) |
416
|
416
|
: $qComp['metadata']->getTableName(); |
417
|
417
|
|
418
|
|
- $orderedColumn = $this->getSQLTableAlias($tableName, $dqlAlias) . '.' . $columnName; |
|
418
|
+ $orderedColumn = $this->getSQLTableAlias($tableName, $dqlAlias).'.'.$columnName; |
419
|
419
|
|
420
|
420
|
// OrderByClause should replace an ordered relation. see - DDC-2475 |
421
|
421
|
if (isset($this->orderedColumnsMap[$orderedColumn])) { |
|
@@ -423,7 +423,7 @@ discard block |
|
|
block discarded – undo |
423
|
423
|
} |
424
|
424
|
|
425
|
425
|
$this->orderedColumnsMap[$orderedColumn] = $orientation; |
426
|
|
- $orderedColumns[] = $orderedColumn . ' ' . $orientation; |
|
426
|
+ $orderedColumns[] = $orderedColumn.' '.$orientation; |
427
|
427
|
} |
428
|
428
|
} |
429
|
429
|
|
|
@@ -458,15 +458,15 @@ discard block |
|
|
block discarded – undo |
458
|
458
|
} |
459
|
459
|
|
460
|
460
|
$sqlTableAlias = ($this->useSqlTableAliases) |
461
|
|
- ? $this->getSQLTableAlias($class->getTableName(), $dqlAlias) . '.' |
|
461
|
+ ? $this->getSQLTableAlias($class->getTableName(), $dqlAlias).'.' |
462
|
462
|
: ''; |
463
|
463
|
|
464
|
|
- $sqlParts[] = $sqlTableAlias . $class->discriminatorColumn['name'] . ' IN (' . implode(', ', $values) . ')'; |
|
464
|
+ $sqlParts[] = $sqlTableAlias.$class->discriminatorColumn['name'].' IN ('.implode(', ', $values).')'; |
465
|
465
|
} |
466
|
466
|
|
467
|
467
|
$sql = implode(' AND ', $sqlParts); |
468
|
468
|
|
469
|
|
- return (count($sqlParts) > 1) ? '(' . $sql . ')' : $sql; |
|
469
|
+ return (count($sqlParts) > 1) ? '('.$sql.')' : $sql; |
470
|
470
|
} |
471
|
471
|
|
472
|
472
|
/** |
|
@@ -479,11 +479,11 @@ discard block |
|
|
block discarded – undo |
479
|
479
|
*/ |
480
|
480
|
private function generateFilterConditionSQL(ClassMetadata $targetEntity, $targetTableAlias) |
481
|
481
|
{ |
482
|
|
- if (!$this->em->hasFilters()) { |
|
482
|
+ if ( ! $this->em->hasFilters()) { |
483
|
483
|
return ''; |
484
|
484
|
} |
485
|
485
|
|
486
|
|
- switch($targetEntity->inheritanceType) { |
|
486
|
+ switch ($targetEntity->inheritanceType) { |
487
|
487
|
case ClassMetadata::INHERITANCE_TYPE_NONE: |
488
|
488
|
break; |
489
|
489
|
case ClassMetadata::INHERITANCE_TYPE_JOINED: |
|
@@ -506,7 +506,7 @@ discard block |
|
|
block discarded – undo |
506
|
506
|
$filterClauses = []; |
507
|
507
|
foreach ($this->em->getFilters()->getEnabledFilters() as $filter) { |
508
|
508
|
if ('' !== $filterExpr = $filter->addFilterConstraint($targetEntity, $targetTableAlias)) { |
509
|
|
- $filterClauses[] = '(' . $filterExpr . ')'; |
|
509
|
+ $filterClauses[] = '('.$filterExpr.')'; |
510
|
510
|
} |
511
|
511
|
} |
512
|
512
|
|
|
@@ -538,7 +538,7 @@ discard block |
|
|
block discarded – undo |
538
|
538
|
} |
539
|
539
|
|
540
|
540
|
if ( ! $AST->orderByClause && ($orderBySql = $this->_generateOrderedCollectionOrderByItems())) { |
541
|
|
- $sql .= ' ORDER BY ' . $orderBySql; |
|
541
|
+ $sql .= ' ORDER BY '.$orderBySql; |
542
|
542
|
} |
543
|
543
|
|
544
|
544
|
if ($limit !== null || $offset !== null) { |
|
@@ -550,11 +550,11 @@ discard block |
|
|
block discarded – undo |
550
|
550
|
} |
551
|
551
|
|
552
|
552
|
if ($lockMode === LockMode::PESSIMISTIC_READ) { |
553
|
|
- return $sql . ' ' . $this->platform->getReadLockSQL(); |
|
553
|
+ return $sql.' '.$this->platform->getReadLockSQL(); |
554
|
554
|
} |
555
|
555
|
|
556
|
556
|
if ($lockMode === LockMode::PESSIMISTIC_WRITE) { |
557
|
|
- return $sql . ' ' . $this->platform->getWriteLockSQL(); |
|
557
|
+ return $sql.' '.$this->platform->getWriteLockSQL(); |
558
|
558
|
} |
559
|
559
|
|
560
|
560
|
if ($lockMode !== LockMode::OPTIMISTIC) { |
|
@@ -609,7 +609,7 @@ discard block |
|
|
block discarded – undo |
609
|
609
|
$sqlParts = []; |
610
|
610
|
|
611
|
611
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($class, $this->platform) as $columnName) { |
612
|
|
- $sqlParts[] = $tableAlias . '.' . $columnName; |
|
612
|
+ $sqlParts[] = $tableAlias.'.'.$columnName; |
613
|
613
|
} |
614
|
614
|
|
615
|
615
|
return implode(', ', $sqlParts); |
|
@@ -652,7 +652,7 @@ discard block |
|
|
block discarded – undo |
652
|
652
|
$class = $this->queryComponents[$dqlAlias]['metadata']; |
653
|
653
|
|
654
|
654
|
if ($this->useSqlTableAliases) { |
655
|
|
- $sql .= $this->walkIdentificationVariable($dqlAlias, $fieldName) . '.'; |
|
655
|
+ $sql .= $this->walkIdentificationVariable($dqlAlias, $fieldName).'.'; |
656
|
656
|
} |
657
|
657
|
|
658
|
658
|
$sql .= $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
|
@@ -681,7 +681,7 @@ discard block |
|
|
block discarded – undo |
681
|
681
|
} |
682
|
682
|
|
683
|
683
|
if ($this->useSqlTableAliases) { |
684
|
|
- $sql .= $this->getSQLTableAlias($class->getTableName(), $dqlAlias) . '.'; |
|
684
|
+ $sql .= $this->getSQLTableAlias($class->getTableName(), $dqlAlias).'.'; |
685
|
685
|
} |
686
|
686
|
|
687
|
687
|
$sql .= reset($assoc['targetToSourceKeyColumns']); |
|
@@ -699,7 +699,7 @@ discard block |
|
|
block discarded – undo |
699
|
699
|
*/ |
700
|
700
|
public function walkSelectClause($selectClause) |
701
|
701
|
{ |
702
|
|
- $sql = 'SELECT ' . (($selectClause->isDistinct) ? 'DISTINCT ' : ''); |
|
702
|
+ $sql = 'SELECT '.(($selectClause->isDistinct) ? 'DISTINCT ' : ''); |
703
|
703
|
$sqlSelectExpressions = array_filter(array_map([$this, 'walkSelectExpression'], $selectClause->selectExpressions)); |
704
|
704
|
|
705
|
705
|
if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && $selectClause->isDistinct) { |
|
@@ -736,7 +736,7 @@ discard block |
|
|
block discarded – undo |
736
|
736
|
$discrColumn = $rootClass->discriminatorColumn; |
737
|
737
|
$columnAlias = $this->getSQLColumnAlias($discrColumn['name']); |
738
|
738
|
|
739
|
|
- $sqlSelectExpressions[] = $tblAlias . '.' . $discrColumn['name'] . ' AS ' . $columnAlias; |
|
739
|
+ $sqlSelectExpressions[] = $tblAlias.'.'.$discrColumn['name'].' AS '.$columnAlias; |
740
|
740
|
|
741
|
741
|
$this->rsm->setDiscriminatorColumn($dqlAlias, $columnAlias); |
742
|
742
|
$this->rsm->addMetaResult($dqlAlias, $columnAlias, $discrColumn['fieldName'], false, $discrColumn['type']); |
|
@@ -750,7 +750,7 @@ discard block |
|
|
block discarded – undo |
750
|
750
|
// Add foreign key columns of class and also parent classes |
751
|
751
|
foreach ($class->associationMappings as $assoc) { |
752
|
752
|
if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE) |
753
|
|
- || ( ! $addMetaColumns && !isset($assoc['id']))) { |
|
753
|
+ || ( ! $addMetaColumns && ! isset($assoc['id']))) { |
754
|
754
|
continue; |
755
|
755
|
} |
756
|
756
|
|
|
@@ -765,7 +765,7 @@ discard block |
|
|
block discarded – undo |
765
|
765
|
$columnType = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em); |
766
|
766
|
|
767
|
767
|
$quotedColumnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $class, $this->platform); |
768
|
|
- $sqlSelectExpressions[] = $sqlTableAlias . '.' . $quotedColumnName . ' AS ' . $columnAlias; |
|
768
|
+ $sqlSelectExpressions[] = $sqlTableAlias.'.'.$quotedColumnName.' AS '.$columnAlias; |
769
|
769
|
|
770
|
770
|
$this->rsm->addMetaResult($dqlAlias, $columnAlias, $columnName, $isIdentifier, $columnType); |
771
|
771
|
} |
|
@@ -794,7 +794,7 @@ discard block |
|
|
block discarded – undo |
794
|
794
|
$columnType = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em); |
795
|
795
|
|
796
|
796
|
$quotedColumnName = $this->quoteStrategy->getJoinColumnName($joinColumn, $subClass, $this->platform); |
797
|
|
- $sqlSelectExpressions[] = $sqlTableAlias . '.' . $quotedColumnName . ' AS ' . $columnAlias; |
|
797
|
+ $sqlSelectExpressions[] = $sqlTableAlias.'.'.$quotedColumnName.' AS '.$columnAlias; |
798
|
798
|
|
799
|
799
|
$this->rsm->addMetaResult($dqlAlias, $columnAlias, $columnName, $subClass->isIdentifier($columnName), $columnType); |
800
|
800
|
} |
|
@@ -820,7 +820,7 @@ discard block |
|
|
block discarded – undo |
820
|
820
|
$sqlParts[] = $this->walkIdentificationVariableDeclaration($identificationVariableDecl); |
821
|
821
|
} |
822
|
822
|
|
823
|
|
- return ' FROM ' . implode(', ', $sqlParts); |
|
823
|
+ return ' FROM '.implode(', ', $sqlParts); |
824
|
824
|
} |
825
|
825
|
|
826
|
826
|
/** |
|
@@ -897,7 +897,7 @@ discard block |
|
|
block discarded – undo |
897
|
897
|
} |
898
|
898
|
|
899
|
899
|
$sql = $this->platform->appendLockHint( |
900
|
|
- $this->quoteStrategy->getTableName($class, $this->platform) . ' ' . |
|
900
|
+ $this->quoteStrategy->getTableName($class, $this->platform).' '. |
901
|
901
|
$this->getSQLTableAlias($class->getTableName(), $dqlAlias), |
902
|
902
|
$this->query->getHint(Query::HINT_LOCK_MODE) |
903
|
903
|
); |
|
@@ -909,10 +909,10 @@ discard block |
|
|
block discarded – undo |
909
|
909
|
$classTableInheritanceJoins = $this->_generateClassTableInheritanceJoins($class, $dqlAlias); |
910
|
910
|
|
911
|
911
|
if ( ! $buildNestedJoins) { |
912
|
|
- return $sql . $classTableInheritanceJoins; |
|
912
|
+ return $sql.$classTableInheritanceJoins; |
913
|
913
|
} |
914
|
914
|
|
915
|
|
- return $classTableInheritanceJoins === '' ? $sql : '(' . $sql . $classTableInheritanceJoins . ')'; |
|
915
|
+ return $classTableInheritanceJoins === '' ? $sql : '('.$sql.$classTableInheritanceJoins.')'; |
916
|
916
|
} |
917
|
917
|
|
918
|
918
|
/** |
|
@@ -945,7 +945,7 @@ discard block |
|
|
block discarded – undo |
945
|
945
|
// Ensure we got the owning side, since it has all mapping info |
946
|
946
|
$assoc = ( ! $relation['isOwningSide']) ? $targetClass->associationMappings[$relation['mappedBy']] : $relation; |
947
|
947
|
|
948
|
|
- if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && (!$this->query->getHint(self::HINT_DISTINCT) || isset($this->selectedClasses[$joinedDqlAlias]))) { |
|
948
|
+ if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && ( ! $this->query->getHint(self::HINT_DISTINCT) || isset($this->selectedClasses[$joinedDqlAlias]))) { |
949
|
949
|
if ($relation['type'] == ClassMetadata::ONE_TO_MANY || $relation['type'] == ClassMetadata::MANY_TO_MANY) { |
950
|
950
|
throw QueryException::iterateWithFetchJoinNotAllowed($assoc); |
951
|
951
|
} |
|
@@ -965,12 +965,12 @@ discard block |
|
|
block discarded – undo |
965
|
965
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
966
|
966
|
|
967
|
967
|
if ($relation['isOwningSide']) { |
968
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedSourceColumn . ' = ' . $targetTableAlias . '.' . $quotedTargetColumn; |
|
968
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedSourceColumn.' = '.$targetTableAlias.'.'.$quotedTargetColumn; |
969
|
969
|
|
970
|
970
|
continue; |
971
|
971
|
} |
972
|
972
|
|
973
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $targetTableAlias . '.' . $quotedSourceColumn; |
|
973
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$targetTableAlias.'.'.$quotedSourceColumn; |
974
|
974
|
} |
975
|
975
|
|
976
|
976
|
// Apply remaining inheritance restrictions |
|
@@ -988,7 +988,7 @@ discard block |
|
|
block discarded – undo |
988
|
988
|
} |
989
|
989
|
|
990
|
990
|
$targetTableJoin = [ |
991
|
|
- 'table' => $targetTableName . ' ' . $targetTableAlias, |
|
991
|
+ 'table' => $targetTableName.' '.$targetTableAlias, |
992
|
992
|
'condition' => implode(' AND ', $conditions), |
993
|
993
|
]; |
994
|
994
|
break; |
|
@@ -1008,10 +1008,10 @@ discard block |
|
|
block discarded – undo |
1008
|
1008
|
$quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
1009
|
1009
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
1010
|
1010
|
|
1011
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
1011
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableAlias.'.'.$quotedSourceColumn; |
1012
|
1012
|
} |
1013
|
1013
|
|
1014
|
|
- $sql .= $joinTableName . ' ' . $joinTableAlias . ' ON ' . implode(' AND ', $conditions); |
|
1014
|
+ $sql .= $joinTableName.' '.$joinTableAlias.' ON '.implode(' AND ', $conditions); |
1015
|
1015
|
|
1016
|
1016
|
// Join target table |
1017
|
1017
|
$sql .= ($joinType == AST\Join::JOIN_TYPE_LEFT || $joinType == AST\Join::JOIN_TYPE_LEFTOUTER) ? ' LEFT JOIN ' : ' INNER JOIN '; |
|
@@ -1025,7 +1025,7 @@ discard block |
|
|
block discarded – undo |
1025
|
1025
|
$quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
1026
|
1026
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
1027
|
1027
|
|
1028
|
|
- $conditions[] = $targetTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
1028
|
+ $conditions[] = $targetTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableAlias.'.'.$quotedSourceColumn; |
1029
|
1029
|
} |
1030
|
1030
|
|
1031
|
1031
|
// Apply remaining inheritance restrictions |
|
@@ -1043,7 +1043,7 @@ discard block |
|
|
block discarded – undo |
1043
|
1043
|
} |
1044
|
1044
|
|
1045
|
1045
|
$targetTableJoin = [ |
1046
|
|
- 'table' => $targetTableName . ' ' . $targetTableAlias, |
|
1046
|
+ 'table' => $targetTableName.' '.$targetTableAlias, |
1047
|
1047
|
'condition' => implode(' AND ', $conditions), |
1048
|
1048
|
]; |
1049
|
1049
|
break; |
|
@@ -1053,22 +1053,22 @@ discard block |
|
|
block discarded – undo |
1053
|
1053
|
} |
1054
|
1054
|
|
1055
|
1055
|
// Handle WITH clause |
1056
|
|
- $withCondition = (null === $condExpr) ? '' : ('(' . $this->walkConditionalExpression($condExpr) . ')'); |
|
1056
|
+ $withCondition = (null === $condExpr) ? '' : ('('.$this->walkConditionalExpression($condExpr).')'); |
1057
|
1057
|
|
1058
|
1058
|
if ($targetClass->isInheritanceTypeJoined()) { |
1059
|
1059
|
$ctiJoins = $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias); |
1060
|
1060
|
// If we have WITH condition, we need to build nested joins for target class table and cti joins |
1061
|
1061
|
if ($withCondition) { |
1062
|
|
- $sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition']; |
|
1062
|
+ $sql .= '('.$targetTableJoin['table'].$ctiJoins.') ON '.$targetTableJoin['condition']; |
1063
|
1063
|
} else { |
1064
|
|
- $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'] . $ctiJoins; |
|
1064
|
+ $sql .= $targetTableJoin['table'].' ON '.$targetTableJoin['condition'].$ctiJoins; |
1065
|
1065
|
} |
1066
|
1066
|
} else { |
1067
|
|
- $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition']; |
|
1067
|
+ $sql .= $targetTableJoin['table'].' ON '.$targetTableJoin['condition']; |
1068
|
1068
|
} |
1069
|
1069
|
|
1070
|
1070
|
if ($withCondition) { |
1071
|
|
- $sql .= ' AND ' . $withCondition; |
|
1071
|
+ $sql .= ' AND '.$withCondition; |
1072
|
1072
|
} |
1073
|
1073
|
|
1074
|
1074
|
// Apply the indexes |
|
@@ -1101,7 +1101,7 @@ discard block |
|
|
block discarded – undo |
1101
|
1101
|
$orderByItems = array_merge($orderByItems, (array) $collectionOrderByItems); |
1102
|
1102
|
} |
1103
|
1103
|
|
1104
|
|
- return ' ORDER BY ' . implode(', ', $orderByItems); |
|
1104
|
+ return ' ORDER BY '.implode(', ', $orderByItems); |
1105
|
1105
|
} |
1106
|
1106
|
|
1107
|
1107
|
/** |
|
@@ -1118,10 +1118,10 @@ discard block |
|
|
block discarded – undo |
1118
|
1118
|
$this->orderedColumnsMap[$sql] = $type; |
1119
|
1119
|
|
1120
|
1120
|
if ($expr instanceof AST\Subselect) { |
1121
|
|
- return '(' . $sql . ') ' . $type; |
|
1121
|
+ return '('.$sql.') '.$type; |
1122
|
1122
|
} |
1123
|
1123
|
|
1124
|
|
- return $sql . ' ' . $type; |
|
1124
|
+ return $sql.' '.$type; |
1125
|
1125
|
} |
1126
|
1126
|
|
1127
|
1127
|
/** |
|
@@ -1129,7 +1129,7 @@ discard block |
|
|
block discarded – undo |
1129
|
1129
|
*/ |
1130
|
1130
|
public function walkHavingClause($havingClause) |
1131
|
1131
|
{ |
1132
|
|
- return ' HAVING ' . $this->walkConditionalExpression($havingClause->conditionalExpression); |
|
1132
|
+ return ' HAVING '.$this->walkConditionalExpression($havingClause->conditionalExpression); |
1133
|
1133
|
} |
1134
|
1134
|
|
1135
|
1135
|
/** |
|
@@ -1152,7 +1152,7 @@ discard block |
|
|
block discarded – undo |
1152
|
1152
|
$conditions = []; |
1153
|
1153
|
|
1154
|
1154
|
if ($join->conditionalExpression) { |
1155
|
|
- $conditions[] = '(' . $this->walkConditionalExpression($join->conditionalExpression) . ')'; |
|
1155
|
+ $conditions[] = '('.$this->walkConditionalExpression($join->conditionalExpression).')'; |
1156
|
1156
|
} |
1157
|
1157
|
|
1158
|
1158
|
$isUnconditionalJoin = empty($conditions); |
|
@@ -1160,7 +1160,7 @@ discard block |
|
|
block discarded – undo |
1160
|
1160
|
? ' AND ' |
1161
|
1161
|
: ' ON '; |
1162
|
1162
|
|
1163
|
|
- $sql .= $this->generateRangeVariableDeclarationSQL($joinDeclaration, !$isUnconditionalJoin); |
|
1163
|
+ $sql .= $this->generateRangeVariableDeclarationSQL($joinDeclaration, ! $isUnconditionalJoin); |
1164
|
1164
|
|
1165
|
1165
|
// Apply remaining inheritance restrictions |
1166
|
1166
|
$discrSql = $this->_generateDiscriminatorColumnConditionSQL([$dqlAlias]); |
|
@@ -1177,7 +1177,7 @@ discard block |
|
|
block discarded – undo |
1177
|
1177
|
} |
1178
|
1178
|
|
1179
|
1179
|
if ($conditions) { |
1180
|
|
- $sql .= $condExprConjunction . implode(' AND ', $conditions); |
|
1180
|
+ $sql .= $condExprConjunction.implode(' AND ', $conditions); |
1181
|
1181
|
} |
1182
|
1182
|
|
1183
|
1183
|
break; |
|
@@ -1207,7 +1207,7 @@ discard block |
|
|
block discarded – undo |
1207
|
1207
|
$scalarExpressions[] = $this->walkSimpleArithmeticExpression($scalarExpression); |
1208
|
1208
|
} |
1209
|
1209
|
|
1210
|
|
- $sql .= implode(', ', $scalarExpressions) . ')'; |
|
1210
|
+ $sql .= implode(', ', $scalarExpressions).')'; |
1211
|
1211
|
|
1212
|
1212
|
return $sql; |
1213
|
1213
|
} |
|
@@ -1229,7 +1229,7 @@ discard block |
|
|
block discarded – undo |
1229
|
1229
|
? $this->conn->quote($nullIfExpression->secondExpression) |
1230
|
1230
|
: $this->walkSimpleArithmeticExpression($nullIfExpression->secondExpression); |
1231
|
1231
|
|
1232
|
|
- return 'NULLIF(' . $firstExpression . ', ' . $secondExpression . ')'; |
|
1232
|
+ return 'NULLIF('.$firstExpression.', '.$secondExpression.')'; |
1233
|
1233
|
} |
1234
|
1234
|
|
1235
|
1235
|
/** |
|
@@ -1244,11 +1244,11 @@ discard block |
|
|
block discarded – undo |
1244
|
1244
|
$sql = 'CASE'; |
1245
|
1245
|
|
1246
|
1246
|
foreach ($generalCaseExpression->whenClauses as $whenClause) { |
1247
|
|
- $sql .= ' WHEN ' . $this->walkConditionalExpression($whenClause->caseConditionExpression); |
1248
|
|
- $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
|
1247
|
+ $sql .= ' WHEN '.$this->walkConditionalExpression($whenClause->caseConditionExpression); |
|
1248
|
+ $sql .= ' THEN '.$this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
1249
|
1249
|
} |
1250
|
1250
|
|
1251
|
|
- $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression) . ' END'; |
|
1251
|
+ $sql .= ' ELSE '.$this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression).' END'; |
1252
|
1252
|
|
1253
|
1253
|
return $sql; |
1254
|
1254
|
} |
|
@@ -1262,14 +1262,14 @@ discard block |
|
|
block discarded – undo |
1262
|
1262
|
*/ |
1263
|
1263
|
public function walkSimpleCaseExpression($simpleCaseExpression) |
1264
|
1264
|
{ |
1265
|
|
- $sql = 'CASE ' . $this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
|
1265
|
+ $sql = 'CASE '.$this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
1266
|
1266
|
|
1267
|
1267
|
foreach ($simpleCaseExpression->simpleWhenClauses as $simpleWhenClause) { |
1268
|
|
- $sql .= ' WHEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
1269
|
|
- $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
|
1268
|
+ $sql .= ' WHEN '.$this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
|
1269
|
+ $sql .= ' THEN '.$this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
1270
|
1270
|
} |
1271
|
1271
|
|
1272
|
|
- $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression) . ' END'; |
|
1272
|
+ $sql .= ' ELSE '.$this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression).' END'; |
1273
|
1273
|
|
1274
|
1274
|
return $sql; |
1275
|
1275
|
} |
|
@@ -1303,14 +1303,14 @@ discard block |
|
|
block discarded – undo |
1303
|
1303
|
$fieldMapping = $class->fieldMappings[$fieldName]; |
1304
|
1304
|
$columnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
1305
|
1305
|
$columnAlias = $this->getSQLColumnAlias($fieldMapping['columnName']); |
1306
|
|
- $col = $sqlTableAlias . '.' . $columnName; |
|
1306
|
+ $col = $sqlTableAlias.'.'.$columnName; |
1307
|
1307
|
|
1308
|
1308
|
if (isset($fieldMapping['requireSQLConversion'])) { |
1309
|
1309
|
$type = Type::getType($fieldMapping['type']); |
1310
|
1310
|
$col = $type->convertToPHPValueSQL($col, $this->conn->getDatabasePlatform()); |
1311
|
1311
|
} |
1312
|
1312
|
|
1313
|
|
- $sql .= $col . ' AS ' . $columnAlias; |
|
1313
|
+ $sql .= $col.' AS '.$columnAlias; |
1314
|
1314
|
|
1315
|
1315
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
1316
|
1316
|
|
|
@@ -1335,7 +1335,7 @@ discard block |
|
|
block discarded – undo |
1335
|
1335
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
1336
|
1336
|
$resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
1337
|
1337
|
|
1338
|
|
- $sql .= $expr->dispatch($this) . ' AS ' . $columnAlias; |
|
1338
|
+ $sql .= $expr->dispatch($this).' AS '.$columnAlias; |
1339
|
1339
|
|
1340
|
1340
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
1341
|
1341
|
|
|
@@ -1349,7 +1349,7 @@ discard block |
|
|
block discarded – undo |
1349
|
1349
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
1350
|
1350
|
$resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
1351
|
1351
|
|
1352
|
|
- $sql .= '(' . $this->walkSubselect($expr) . ') AS ' . $columnAlias; |
|
1352
|
+ $sql .= '('.$this->walkSubselect($expr).') AS '.$columnAlias; |
1353
|
1353
|
|
1354
|
1354
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
1355
|
1355
|
|
|
@@ -1360,7 +1360,7 @@ discard block |
|
|
block discarded – undo |
1360
|
1360
|
break; |
1361
|
1361
|
|
1362
|
1362
|
case ($expr instanceof AST\NewObjectExpression): |
1363
|
|
- $sql .= $this->walkNewObject($expr,$selectExpression->fieldIdentificationVariable); |
|
1363
|
+ $sql .= $this->walkNewObject($expr, $selectExpression->fieldIdentificationVariable); |
1364
|
1364
|
break; |
1365
|
1365
|
|
1366
|
1366
|
default: |
|
@@ -1401,14 +1401,14 @@ discard block |
|
|
block discarded – undo |
1401
|
1401
|
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
1402
|
1402
|
$quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
1403
|
1403
|
|
1404
|
|
- $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
1404
|
+ $col = $sqlTableAlias.'.'.$quotedColumnName; |
1405
|
1405
|
|
1406
|
1406
|
if (isset($mapping['requireSQLConversion'])) { |
1407
|
1407
|
$type = Type::getType($mapping['type']); |
1408
|
1408
|
$col = $type->convertToPHPValueSQL($col, $this->platform); |
1409
|
1409
|
} |
1410
|
1410
|
|
1411
|
|
- $sqlParts[] = $col . ' AS '. $columnAlias; |
|
1411
|
+ $sqlParts[] = $col.' AS '.$columnAlias; |
1412
|
1412
|
|
1413
|
1413
|
$this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
1414
|
1414
|
|
|
@@ -1425,21 +1425,21 @@ discard block |
|
|
block discarded – undo |
1425
|
1425
|
$sqlTableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias); |
1426
|
1426
|
|
1427
|
1427
|
foreach ($subClass->fieldMappings as $fieldName => $mapping) { |
1428
|
|
- if (isset($mapping['inherited']) || ($partialFieldSet && !in_array($fieldName, $partialFieldSet))) { |
|
1428
|
+ if (isset($mapping['inherited']) || ($partialFieldSet && ! in_array($fieldName, $partialFieldSet))) { |
1429
|
1429
|
continue; |
1430
|
1430
|
} |
1431
|
1431
|
|
1432
|
1432
|
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
1433
|
1433
|
$quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $subClass, $this->platform); |
1434
|
1434
|
|
1435
|
|
- $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
1435
|
+ $col = $sqlTableAlias.'.'.$quotedColumnName; |
1436
|
1436
|
|
1437
|
1437
|
if (isset($mapping['requireSQLConversion'])) { |
1438
|
1438
|
$type = Type::getType($mapping['type']); |
1439
|
1439
|
$col = $type->convertToPHPValueSQL($col, $this->platform); |
1440
|
1440
|
} |
1441
|
1441
|
|
1442
|
|
- $sqlParts[] = $col . ' AS ' . $columnAlias; |
|
1442
|
+ $sqlParts[] = $col.' AS '.$columnAlias; |
1443
|
1443
|
|
1444
|
1444
|
$this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
1445
|
1445
|
|
|
@@ -1459,7 +1459,7 @@ discard block |
|
|
block discarded – undo |
1459
|
1459
|
*/ |
1460
|
1460
|
public function walkQuantifiedExpression($qExpr) |
1461
|
1461
|
{ |
1462
|
|
- return ' ' . strtoupper($qExpr->type) . '(' . $this->walkSubselect($qExpr->subselect) . ')'; |
|
1462
|
+ return ' '.strtoupper($qExpr->type).'('.$this->walkSubselect($qExpr->subselect).')'; |
1463
|
1463
|
} |
1464
|
1464
|
|
1465
|
1465
|
/** |
|
@@ -1499,7 +1499,7 @@ discard block |
|
|
block discarded – undo |
1499
|
1499
|
$sqlParts[] = $this->walkIdentificationVariableDeclaration($subselectIdVarDecl); |
1500
|
1500
|
} |
1501
|
1501
|
|
1502
|
|
- return ' FROM ' . implode(', ', $sqlParts); |
|
1502
|
+ return ' FROM '.implode(', ', $sqlParts); |
1503
|
1503
|
} |
1504
|
1504
|
|
1505
|
1505
|
/** |
|
@@ -1507,7 +1507,7 @@ discard block |
|
|
block discarded – undo |
1507
|
1507
|
*/ |
1508
|
1508
|
public function walkSimpleSelectClause($simpleSelectClause) |
1509
|
1509
|
{ |
1510
|
|
- return 'SELECT' . ($simpleSelectClause->isDistinct ? ' DISTINCT' : '') |
|
1510
|
+ return 'SELECT'.($simpleSelectClause->isDistinct ? ' DISTINCT' : '') |
1511
|
1511
|
. $this->walkSimpleSelectExpression($simpleSelectClause->simpleSelectExpression); |
1512
|
1512
|
} |
1513
|
1513
|
|
|
@@ -1526,10 +1526,10 @@ discard block |
|
|
block discarded – undo |
1526
|
1526
|
* @param null|string $newObjectResultAlias |
1527
|
1527
|
* @return string The SQL. |
1528
|
1528
|
*/ |
1529
|
|
- public function walkNewObject($newObjectExpression, $newObjectResultAlias=null) |
|
1529
|
+ public function walkNewObject($newObjectExpression, $newObjectResultAlias = null) |
1530
|
1530
|
{ |
1531
|
1531
|
$sqlSelectExpressions = []; |
1532
|
|
- $objIndex = $newObjectResultAlias?:$this->newObjectCounter++; |
|
1532
|
+ $objIndex = $newObjectResultAlias ?: $this->newObjectCounter++; |
1533
|
1533
|
|
1534
|
1534
|
foreach ($newObjectExpression->args as $argIndex => $e) { |
1535
|
1535
|
$resultAlias = $this->scalarResultCounter++; |
|
@@ -1542,7 +1542,7 @@ discard block |
|
|
block discarded – undo |
1542
|
1542
|
break; |
1543
|
1543
|
|
1544
|
1544
|
case ($e instanceof AST\Subselect): |
1545
|
|
- $sqlSelectExpressions[] = '(' . $e->dispatch($this) . ') AS ' . $columnAlias; |
|
1545
|
+ $sqlSelectExpressions[] = '('.$e->dispatch($this).') AS '.$columnAlias; |
1546
|
1546
|
break; |
1547
|
1547
|
|
1548
|
1548
|
case ($e instanceof AST\PathExpression): |
|
@@ -1559,7 +1559,7 @@ discard block |
|
|
block discarded – undo |
1559
|
1559
|
$col = $type->convertToPHPValueSQL($col, $this->platform); |
1560
|
1560
|
} |
1561
|
1561
|
|
1562
|
|
- $sqlSelectExpressions[] = $col . ' AS ' . $columnAlias; |
|
1562
|
+ $sqlSelectExpressions[] = $col.' AS '.$columnAlias; |
1563
|
1563
|
break; |
1564
|
1564
|
|
1565
|
1565
|
case ($e instanceof AST\Literal): |
|
@@ -1573,11 +1573,11 @@ discard block |
|
|
block discarded – undo |
1573
|
1573
|
break; |
1574
|
1574
|
} |
1575
|
1575
|
|
1576
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
1576
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
1577
|
1577
|
break; |
1578
|
1578
|
|
1579
|
1579
|
default: |
1580
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
1580
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
1581
|
1581
|
break; |
1582
|
1582
|
} |
1583
|
1583
|
|
|
@@ -1610,10 +1610,10 @@ discard block |
|
|
block discarded – undo |
1610
|
1610
|
case ($expr instanceof AST\Subselect): |
1611
|
1611
|
$alias = $simpleSelectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
1612
|
1612
|
|
1613
|
|
- $columnAlias = 'sclr' . $this->aliasCounter++; |
|
1613
|
+ $columnAlias = 'sclr'.$this->aliasCounter++; |
1614
|
1614
|
$this->scalarResultAliasMap[$alias] = $columnAlias; |
1615
|
1615
|
|
1616
|
|
- $sql .= '(' . $this->walkSubselect($expr) . ') AS ' . $columnAlias; |
|
1616
|
+ $sql .= '('.$this->walkSubselect($expr).') AS '.$columnAlias; |
1617
|
1617
|
break; |
1618
|
1618
|
|
1619
|
1619
|
case ($expr instanceof AST\Functions\FunctionNode): |
|
@@ -1630,7 +1630,7 @@ discard block |
|
|
block discarded – undo |
1630
|
1630
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
1631
|
1631
|
$this->scalarResultAliasMap[$alias] = $columnAlias; |
1632
|
1632
|
|
1633
|
|
- $sql .= $expr->dispatch($this) . ' AS ' . $columnAlias; |
|
1633
|
+ $sql .= $expr->dispatch($this).' AS '.$columnAlias; |
1634
|
1634
|
break; |
1635
|
1635
|
|
1636
|
1636
|
case ($expr instanceof AST\ParenthesisExpression): |
|
@@ -1650,8 +1650,8 @@ discard block |
|
|
block discarded – undo |
1650
|
1650
|
*/ |
1651
|
1651
|
public function walkAggregateExpression($aggExpression) |
1652
|
1652
|
{ |
1653
|
|
- return $aggExpression->functionName . '(' . ($aggExpression->isDistinct ? 'DISTINCT ' : '') |
1654
|
|
- . $this->walkSimpleArithmeticExpression($aggExpression->pathExpression) . ')'; |
|
1653
|
+ return $aggExpression->functionName.'('.($aggExpression->isDistinct ? 'DISTINCT ' : '') |
|
1654
|
+ . $this->walkSimpleArithmeticExpression($aggExpression->pathExpression).')'; |
1655
|
1655
|
} |
1656
|
1656
|
|
1657
|
1657
|
/** |
|
@@ -1665,7 +1665,7 @@ discard block |
|
|
block discarded – undo |
1665
|
1665
|
$sqlParts[] = $this->walkGroupByItem($groupByItem); |
1666
|
1666
|
} |
1667
|
1667
|
|
1668
|
|
- return ' GROUP BY ' . implode(', ', $sqlParts); |
|
1668
|
+ return ' GROUP BY '.implode(', ', $sqlParts); |
1669
|
1669
|
} |
1670
|
1670
|
|
1671
|
1671
|
/** |
|
@@ -1722,7 +1722,7 @@ discard block |
|
|
block discarded – undo |
1722
|
1722
|
{ |
1723
|
1723
|
$class = $this->em->getClassMetadata($deleteClause->abstractSchemaName); |
1724
|
1724
|
$tableName = $class->getTableName(); |
1725
|
|
- $sql = 'DELETE FROM ' . $this->quoteStrategy->getTableName($class, $this->platform); |
|
1725
|
+ $sql = 'DELETE FROM '.$this->quoteStrategy->getTableName($class, $this->platform); |
1726
|
1726
|
|
1727
|
1727
|
$this->setSQLTableAlias($tableName, $tableName, $deleteClause->aliasIdentificationVariable); |
1728
|
1728
|
$this->rootAliases[] = $deleteClause->aliasIdentificationVariable; |
|
@@ -1737,12 +1737,12 @@ discard block |
|
|
block discarded – undo |
1737
|
1737
|
{ |
1738
|
1738
|
$class = $this->em->getClassMetadata($updateClause->abstractSchemaName); |
1739
|
1739
|
$tableName = $class->getTableName(); |
1740
|
|
- $sql = 'UPDATE ' . $this->quoteStrategy->getTableName($class, $this->platform); |
|
1740
|
+ $sql = 'UPDATE '.$this->quoteStrategy->getTableName($class, $this->platform); |
1741
|
1741
|
|
1742
|
1742
|
$this->setSQLTableAlias($tableName, $tableName, $updateClause->aliasIdentificationVariable); |
1743
|
1743
|
$this->rootAliases[] = $updateClause->aliasIdentificationVariable; |
1744
|
1744
|
|
1745
|
|
- $sql .= ' SET ' . implode(', ', array_map([$this, 'walkUpdateItem'], $updateClause->updateItems)); |
|
1745
|
+ $sql .= ' SET '.implode(', ', array_map([$this, 'walkUpdateItem'], $updateClause->updateItems)); |
1746
|
1746
|
|
1747
|
1747
|
return $sql; |
1748
|
1748
|
} |
|
@@ -1755,7 +1755,7 @@ discard block |
|
|
block discarded – undo |
1755
|
1755
|
$useTableAliasesBefore = $this->useSqlTableAliases; |
1756
|
1756
|
$this->useSqlTableAliases = false; |
1757
|
1757
|
|
1758
|
|
- $sql = $this->walkPathExpression($updateItem->pathExpression) . ' = '; |
|
1758
|
+ $sql = $this->walkPathExpression($updateItem->pathExpression).' = '; |
1759
|
1759
|
$newValue = $updateItem->newValue; |
1760
|
1760
|
|
1761
|
1761
|
switch (true) { |
|
@@ -1798,7 +1798,7 @@ discard block |
|
|
block discarded – undo |
1798
|
1798
|
|
1799
|
1799
|
if (count($filterClauses)) { |
1800
|
1800
|
if ($condSql) { |
1801
|
|
- $condSql = '(' . $condSql . ') AND '; |
|
1801
|
+ $condSql = '('.$condSql.') AND '; |
1802
|
1802
|
} |
1803
|
1803
|
|
1804
|
1804
|
$condSql .= implode(' AND ', $filterClauses); |
|
@@ -1806,11 +1806,11 @@ discard block |
|
|
block discarded – undo |
1806
|
1806
|
} |
1807
|
1807
|
|
1808
|
1808
|
if ($condSql) { |
1809
|
|
- return ' WHERE ' . (( ! $discrSql) ? $condSql : '(' . $condSql . ') AND ' . $discrSql); |
|
1809
|
+ return ' WHERE '.(( ! $discrSql) ? $condSql : '('.$condSql.') AND '.$discrSql); |
1810
|
1810
|
} |
1811
|
1811
|
|
1812
|
1812
|
if ($discrSql) { |
1813
|
|
- return ' WHERE ' . $discrSql; |
|
1813
|
+ return ' WHERE '.$discrSql; |
1814
|
1814
|
} |
1815
|
1815
|
|
1816
|
1816
|
return ''; |
|
@@ -1853,7 +1853,7 @@ discard block |
|
|
block discarded – undo |
1853
|
1853
|
// if only one ConditionalPrimary is defined |
1854
|
1854
|
return ( ! ($factor instanceof AST\ConditionalFactor)) |
1855
|
1855
|
? $this->walkConditionalPrimary($factor) |
1856
|
|
- : ($factor->not ? 'NOT ' : '') . $this->walkConditionalPrimary($factor->conditionalPrimary); |
|
1856
|
+ : ($factor->not ? 'NOT ' : '').$this->walkConditionalPrimary($factor->conditionalPrimary); |
1857
|
1857
|
} |
1858
|
1858
|
|
1859
|
1859
|
/** |
|
@@ -1868,7 +1868,7 @@ discard block |
|
|
block discarded – undo |
1868
|
1868
|
if ($primary->isConditionalExpression()) { |
1869
|
1869
|
$condExpr = $primary->conditionalExpression; |
1870
|
1870
|
|
1871
|
|
- return '(' . $this->walkConditionalExpression($condExpr) . ')'; |
|
1871
|
+ return '('.$this->walkConditionalExpression($condExpr).')'; |
1872
|
1872
|
} |
1873
|
1873
|
} |
1874
|
1874
|
|
|
@@ -1879,7 +1879,7 @@ discard block |
|
|
block discarded – undo |
1879
|
1879
|
{ |
1880
|
1880
|
$sql = ($existsExpr->not) ? 'NOT ' : ''; |
1881
|
1881
|
|
1882
|
|
- $sql .= 'EXISTS (' . $this->walkSubselect($existsExpr->subselect) . ')'; |
|
1882
|
+ $sql .= 'EXISTS ('.$this->walkSubselect($existsExpr->subselect).')'; |
1883
|
1883
|
|
1884
|
1884
|
return $sql; |
1885
|
1885
|
} |
|
@@ -1923,7 +1923,7 @@ discard block |
|
|
block discarded – undo |
1923
|
1923
|
$targetTableAlias = $this->getSQLTableAlias($targetClass->getTableName()); |
1924
|
1924
|
$sourceTableAlias = $this->getSQLTableAlias($class->getTableName(), $dqlAlias); |
1925
|
1925
|
|
1926
|
|
- $sql .= $this->quoteStrategy->getTableName($targetClass, $this->platform) . ' ' . $targetTableAlias . ' WHERE '; |
|
1926
|
+ $sql .= $this->quoteStrategy->getTableName($targetClass, $this->platform).' '.$targetTableAlias.' WHERE '; |
1927
|
1927
|
|
1928
|
1928
|
$owningAssoc = $targetClass->associationMappings[$assoc['mappedBy']]; |
1929
|
1929
|
$sqlParts = []; |
|
@@ -1931,7 +1931,7 @@ discard block |
|
|
block discarded – undo |
1931
|
1931
|
foreach ($owningAssoc['targetToSourceKeyColumns'] as $targetColumn => $sourceColumn) { |
1932
|
1932
|
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$targetColumn], $class, $this->platform); |
1933
|
1933
|
|
1934
|
|
- $sqlParts[] = $sourceTableAlias . '.' . $targetColumn . ' = ' . $targetTableAlias . '.' . $sourceColumn; |
|
1934
|
+ $sqlParts[] = $sourceTableAlias.'.'.$targetColumn.' = '.$targetTableAlias.'.'.$sourceColumn; |
1935
|
1935
|
} |
1936
|
1936
|
|
1937
|
1937
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($targetClass, $this->platform) as $targetColumnName) { |
|
@@ -1939,7 +1939,7 @@ discard block |
|
|
block discarded – undo |
1939
|
1939
|
$this->parserResult->addParameterMapping($dqlParamKey, $this->sqlParamIndex++); |
1940
|
1940
|
} |
1941
|
1941
|
|
1942
|
|
- $sqlParts[] = $targetTableAlias . '.' . $targetColumnName . ' = ' . $entitySql; |
|
1942
|
+ $sqlParts[] = $targetTableAlias.'.'.$targetColumnName.' = '.$entitySql; |
1943
|
1943
|
} |
1944
|
1944
|
|
1945
|
1945
|
$sql .= implode(' AND ', $sqlParts); |
|
@@ -1955,8 +1955,8 @@ discard block |
|
|
block discarded – undo |
1955
|
1955
|
$sourceTableAlias = $this->getSQLTableAlias($class->getTableName(), $dqlAlias); |
1956
|
1956
|
|
1957
|
1957
|
// join to target table |
1958
|
|
- $sql .= $this->quoteStrategy->getJoinTableName($owningAssoc, $targetClass, $this->platform) . ' ' . $joinTableAlias |
1959
|
|
- . ' INNER JOIN ' . $this->quoteStrategy->getTableName($targetClass, $this->platform) . ' ' . $targetTableAlias . ' ON '; |
|
1958
|
+ $sql .= $this->quoteStrategy->getJoinTableName($owningAssoc, $targetClass, $this->platform).' '.$joinTableAlias |
|
1959
|
+ . ' INNER JOIN '.$this->quoteStrategy->getTableName($targetClass, $this->platform).' '.$targetTableAlias.' ON '; |
1960
|
1960
|
|
1961
|
1961
|
// join conditions |
1962
|
1962
|
$joinColumns = $assoc['isOwningSide'] ? $joinTable['inverseJoinColumns'] : $joinTable['joinColumns']; |
|
@@ -1965,7 +1965,7 @@ discard block |
|
|
block discarded – undo |
1965
|
1965
|
foreach ($joinColumns as $joinColumn) { |
1966
|
1966
|
$targetColumn = $this->quoteStrategy->getColumnName($targetClass->fieldNames[$joinColumn['referencedColumnName']], $targetClass, $this->platform); |
1967
|
1967
|
|
1968
|
|
- $joinSqlParts[] = $joinTableAlias . '.' . $joinColumn['name'] . ' = ' . $targetTableAlias . '.' . $targetColumn; |
|
1968
|
+ $joinSqlParts[] = $joinTableAlias.'.'.$joinColumn['name'].' = '.$targetTableAlias.'.'.$targetColumn; |
1969
|
1969
|
} |
1970
|
1970
|
|
1971
|
1971
|
$sql .= implode(' AND ', $joinSqlParts); |
|
@@ -1977,7 +1977,7 @@ discard block |
|
|
block discarded – undo |
1977
|
1977
|
foreach ($joinColumns as $joinColumn) { |
1978
|
1978
|
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$joinColumn['referencedColumnName']], $class, $this->platform); |
1979
|
1979
|
|
1980
|
|
- $sqlParts[] = $joinTableAlias . '.' . $joinColumn['name'] . ' = ' . $sourceTableAlias . '.' . $targetColumn; |
|
1980
|
+ $sqlParts[] = $joinTableAlias.'.'.$joinColumn['name'].' = '.$sourceTableAlias.'.'.$targetColumn; |
1981
|
1981
|
} |
1982
|
1982
|
|
1983
|
1983
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($targetClass, $this->platform) as $targetColumnName) { |
|
@@ -1985,13 +1985,13 @@ discard block |
|
|
block discarded – undo |
1985
|
1985
|
$this->parserResult->addParameterMapping($dqlParamKey, $this->sqlParamIndex++); |
1986
|
1986
|
} |
1987
|
1987
|
|
1988
|
|
- $sqlParts[] = $targetTableAlias . '.' . $targetColumnName . ' IN (' . $entitySql . ')'; |
|
1988
|
+ $sqlParts[] = $targetTableAlias.'.'.$targetColumnName.' IN ('.$entitySql.')'; |
1989
|
1989
|
} |
1990
|
1990
|
|
1991
|
1991
|
$sql .= implode(' AND ', $sqlParts); |
1992
|
1992
|
} |
1993
|
1993
|
|
1994
|
|
- return $sql . ')'; |
|
1994
|
+ return $sql.')'; |
1995
|
1995
|
} |
1996
|
1996
|
|
1997
|
1997
|
/** |
|
@@ -2002,7 +2002,7 @@ discard block |
|
|
block discarded – undo |
2002
|
2002
|
$sizeFunc = new AST\Functions\SizeFunction('size'); |
2003
|
2003
|
$sizeFunc->collectionPathExpression = $emptyCollCompExpr->expression; |
2004
|
2004
|
|
2005
|
|
- return $sizeFunc->getSql($this) . ($emptyCollCompExpr->not ? ' > 0' : ' = 0'); |
|
2005
|
+ return $sizeFunc->getSql($this).($emptyCollCompExpr->not ? ' > 0' : ' = 0'); |
2006
|
2006
|
} |
2007
|
2007
|
|
2008
|
2008
|
/** |
|
@@ -2011,19 +2011,19 @@ discard block |
|
|
block discarded – undo |
2011
|
2011
|
public function walkNullComparisonExpression($nullCompExpr) |
2012
|
2012
|
{ |
2013
|
2013
|
$expression = $nullCompExpr->expression; |
2014
|
|
- $comparison = ' IS' . ($nullCompExpr->not ? ' NOT' : '') . ' NULL'; |
|
2014
|
+ $comparison = ' IS'.($nullCompExpr->not ? ' NOT' : '').' NULL'; |
2015
|
2015
|
|
2016
|
2016
|
// Handle ResultVariable |
2017
|
2017
|
if (is_string($expression) && isset($this->queryComponents[$expression]['resultVariable'])) { |
2018
|
|
- return $this->walkResultVariable($expression) . $comparison; |
|
2018
|
+ return $this->walkResultVariable($expression).$comparison; |
2019
|
2019
|
} |
2020
|
2020
|
|
2021
|
2021
|
// Handle InputParameter mapping inclusion to ParserResult |
2022
|
2022
|
if ($expression instanceof AST\InputParameter) { |
2023
|
|
- return $this->walkInputParameter($expression) . $comparison; |
|
2023
|
+ return $this->walkInputParameter($expression).$comparison; |
2024
|
2024
|
} |
2025
|
2025
|
|
2026
|
|
- return $expression->dispatch($this) . $comparison; |
|
2026
|
+ return $expression->dispatch($this).$comparison; |
2027
|
2027
|
} |
2028
|
2028
|
|
2029
|
2029
|
/** |
|
@@ -2031,7 +2031,7 @@ discard block |
|
|
block discarded – undo |
2031
|
2031
|
*/ |
2032
|
2032
|
public function walkInExpression($inExpr) |
2033
|
2033
|
{ |
2034
|
|
- $sql = $this->walkArithmeticExpression($inExpr->expression) . ($inExpr->not ? ' NOT' : '') . ' IN ('; |
|
2034
|
+ $sql = $this->walkArithmeticExpression($inExpr->expression).($inExpr->not ? ' NOT' : '').' IN ('; |
2035
|
2035
|
|
2036
|
2036
|
$sql .= ($inExpr->subselect) |
2037
|
2037
|
? $this->walkSubselect($inExpr->subselect) |
|
@@ -2058,10 +2058,10 @@ discard block |
|
|
block discarded – undo |
2058
|
2058
|
} |
2059
|
2059
|
|
2060
|
2060
|
if ($this->useSqlTableAliases) { |
2061
|
|
- $sql .= $this->getSQLTableAlias($discrClass->getTableName(), $dqlAlias) . '.'; |
|
2061
|
+ $sql .= $this->getSQLTableAlias($discrClass->getTableName(), $dqlAlias).'.'; |
2062
|
2062
|
} |
2063
|
2063
|
|
2064
|
|
- $sql .= $class->discriminatorColumn['name'] . ($instanceOfExpr->not ? ' NOT IN ' : ' IN '); |
|
2064
|
+ $sql .= $class->discriminatorColumn['name'].($instanceOfExpr->not ? ' NOT IN ' : ' IN '); |
2065
|
2065
|
$sql .= $this->getChildDiscriminatorsFromClassMetadata($discrClass, $instanceOfExpr); |
2066
|
2066
|
|
2067
|
2067
|
return $sql; |
|
@@ -2108,8 +2108,8 @@ discard block |
|
|
block discarded – undo |
2108
|
2108
|
$sql .= ' NOT'; |
2109
|
2109
|
} |
2110
|
2110
|
|
2111
|
|
- $sql .= ' BETWEEN ' . $this->walkArithmeticExpression($betweenExpr->leftBetweenExpression) |
2112
|
|
- . ' AND ' . $this->walkArithmeticExpression($betweenExpr->rightBetweenExpression); |
|
2111
|
+ $sql .= ' BETWEEN '.$this->walkArithmeticExpression($betweenExpr->leftBetweenExpression) |
|
2112
|
+ . ' AND '.$this->walkArithmeticExpression($betweenExpr->rightBetweenExpression); |
2113
|
2113
|
|
2114
|
2114
|
return $sql; |
2115
|
2115
|
} |
|
@@ -2124,7 +2124,7 @@ discard block |
|
|
block discarded – undo |
2124
|
2124
|
? $this->walkResultVariable($stringExpr) |
2125
|
2125
|
: $stringExpr->dispatch($this); |
2126
|
2126
|
|
2127
|
|
- $sql = $leftExpr . ($likeExpr->not ? ' NOT' : '') . ' LIKE '; |
|
2127
|
+ $sql = $leftExpr.($likeExpr->not ? ' NOT' : '').' LIKE '; |
2128
|
2128
|
|
2129
|
2129
|
if ($likeExpr->stringPattern instanceof AST\InputParameter) { |
2130
|
2130
|
$sql .= $this->walkInputParameter($likeExpr->stringPattern); |
|
@@ -2137,7 +2137,7 @@ discard block |
|
|
block discarded – undo |
2137
|
2137
|
} |
2138
|
2138
|
|
2139
|
2139
|
if ($likeExpr->escapeChar) { |
2140
|
|
- $sql .= ' ESCAPE ' . $this->walkLiteral($likeExpr->escapeChar); |
|
2140
|
+ $sql .= ' ESCAPE '.$this->walkLiteral($likeExpr->escapeChar); |
2141
|
2141
|
} |
2142
|
2142
|
|
2143
|
2143
|
return $sql; |
|
@@ -2164,7 +2164,7 @@ discard block |
|
|
block discarded – undo |
2164
|
2164
|
? $leftExpr->dispatch($this) |
2165
|
2165
|
: (is_numeric($leftExpr) ? $leftExpr : $this->conn->quote($leftExpr)); |
2166
|
2166
|
|
2167
|
|
- $sql .= ' ' . $compExpr->operator . ' '; |
|
2167
|
+ $sql .= ' '.$compExpr->operator.' '; |
2168
|
2168
|
|
2169
|
2169
|
$sql .= ($rightExpr instanceof AST\Node) |
2170
|
2170
|
? $rightExpr->dispatch($this) |
|
@@ -2196,7 +2196,7 @@ discard block |
|
|
block discarded – undo |
2196
|
2196
|
{ |
2197
|
2197
|
return ($arithmeticExpr->isSimpleArithmeticExpression()) |
2198
|
2198
|
? $this->walkSimpleArithmeticExpression($arithmeticExpr->simpleArithmeticExpression) |
2199
|
|
- : '(' . $this->walkSubselect($arithmeticExpr->subselect) . ')'; |
|
2199
|
+ : '('.$this->walkSubselect($arithmeticExpr->subselect).')'; |
2200
|
2200
|
} |
2201
|
2201
|
|
2202
|
2202
|
/** |
|
@@ -2250,7 +2250,7 @@ discard block |
|
|
block discarded – undo |
2250
|
2250
|
|
2251
|
2251
|
$sign = $factor->isNegativeSigned() ? '-' : ($factor->isPositiveSigned() ? '+' : ''); |
2252
|
2252
|
|
2253
|
|
- return $sign . $this->walkArithmeticPrimary($factor->arithmeticPrimary); |
|
2253
|
+ return $sign.$this->walkArithmeticPrimary($factor->arithmeticPrimary); |
2254
|
2254
|
} |
2255
|
2255
|
|
2256
|
2256
|
/** |
|
@@ -2263,7 +2263,7 @@ discard block |
|
|
block discarded – undo |
2263
|
2263
|
public function walkArithmeticPrimary($primary) |
2264
|
2264
|
{ |
2265
|
2265
|
if ($primary instanceof AST\SimpleArithmeticExpression) { |
2266
|
|
- return '(' . $this->walkSimpleArithmeticExpression($primary) . ')'; |
|
2266
|
+ return '('.$this->walkSimpleArithmeticExpression($primary).')'; |
2267
|
2267
|
} |
2268
|
2268
|
|
2269
|
2269
|
if ($primary instanceof AST\Node) { |
|
@@ -2327,6 +2327,6 @@ discard block |
|
|
block discarded – undo |
2327
|
2327
|
$sqlParameterList[] = $this->conn->quote($dis); |
2328
|
2328
|
} |
2329
|
2329
|
|
2330
|
|
- return '(' . implode(', ', $sqlParameterList) . ')'; |
|
2330
|
+ return '('.implode(', ', $sqlParameterList).')'; |
2331
|
2331
|
} |
2332
|
2332
|
} |