|
@@ -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); |
|
@@ -651,7 +651,7 @@ discard block |
|
|
block discarded – undo |
|
651
|
651
|
$class = $this->queryComponents[$dqlAlias]['metadata']; |
|
652
|
652
|
|
|
653
|
653
|
if ($this->useSqlTableAliases) { |
|
654
|
|
- $sql .= $this->walkIdentificationVariable($dqlAlias, $fieldName) . '.'; |
|
|
654
|
+ $sql .= $this->walkIdentificationVariable($dqlAlias, $fieldName).'.'; |
|
655
|
655
|
} |
|
656
|
656
|
|
|
657
|
657
|
$sql .= $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
|
@@ -680,7 +680,7 @@ discard block |
|
|
block discarded – undo |
|
680
|
680
|
} |
|
681
|
681
|
|
|
682
|
682
|
if ($this->useSqlTableAliases) { |
|
683
|
|
- $sql .= $this->getSQLTableAlias($class->getTableName(), $dqlAlias) . '.'; |
|
|
683
|
+ $sql .= $this->getSQLTableAlias($class->getTableName(), $dqlAlias).'.'; |
|
684
|
684
|
} |
|
685
|
685
|
|
|
686
|
686
|
$sql .= reset($assoc['targetToSourceKeyColumns']); |
|
@@ -698,7 +698,7 @@ discard block |
|
|
block discarded – undo |
|
698
|
698
|
*/ |
|
699
|
699
|
public function walkSelectClause($selectClause) |
|
700
|
700
|
{ |
|
701
|
|
- $sql = 'SELECT ' . (($selectClause->isDistinct) ? 'DISTINCT ' : ''); |
|
|
701
|
+ $sql = 'SELECT '.(($selectClause->isDistinct) ? 'DISTINCT ' : ''); |
|
702
|
702
|
$sqlSelectExpressions = array_filter(array_map([$this, 'walkSelectExpression'], $selectClause->selectExpressions)); |
|
703
|
703
|
|
|
704
|
704
|
if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && $selectClause->isDistinct) { |
|
@@ -735,7 +735,7 @@ discard block |
|
|
block discarded – undo |
|
735
|
735
|
$discrColumn = $rootClass->discriminatorColumn; |
|
736
|
736
|
$columnAlias = $this->getSQLColumnAlias($discrColumn['name']); |
|
737
|
737
|
|
|
738
|
|
- $sqlSelectExpressions[] = $tblAlias . '.' . $discrColumn['name'] . ' AS ' . $columnAlias; |
|
|
738
|
+ $sqlSelectExpressions[] = $tblAlias.'.'.$discrColumn['name'].' AS '.$columnAlias; |
|
739
|
739
|
|
|
740
|
740
|
$this->rsm->setDiscriminatorColumn($dqlAlias, $columnAlias); |
|
741
|
741
|
$this->rsm->addMetaResult($dqlAlias, $columnAlias, $discrColumn['fieldName'], false, $discrColumn['type']); |
|
@@ -750,7 +750,7 @@ discard block |
|
|
block discarded – undo |
|
750
|
750
|
foreach ($class->associationMappings as $assoc) { |
|
751
|
751
|
if ( ! ($assoc['isOwningSide'] && $assoc['type'] & ClassMetadata::TO_ONE)) { |
|
752
|
752
|
continue; |
|
753
|
|
- } else if ( !$addMetaColumns && !isset($assoc['id'])) { |
|
|
753
|
+ } else if ( ! $addMetaColumns && ! isset($assoc['id'])) { |
|
754
|
754
|
continue; |
|
755
|
755
|
} |
|
756
|
756
|
|
|
@@ -764,7 +764,7 @@ discard block |
|
|
block discarded – undo |
|
764
|
764
|
$columnAlias = $this->getSQLColumnAlias($columnName); |
|
765
|
765
|
$columnType = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em); |
|
766
|
766
|
|
|
767
|
|
- $sqlSelectExpressions[] = $sqlTableAlias . '.' . $columnName . ' AS ' . $columnAlias; |
|
|
767
|
+ $sqlSelectExpressions[] = $sqlTableAlias.'.'.$columnName.' AS '.$columnAlias; |
|
768
|
768
|
|
|
769
|
769
|
$this->rsm->addMetaResult($dqlAlias, $columnAlias, $columnName, $isIdentifier, $columnType); |
|
770
|
770
|
} |
|
@@ -792,7 +792,7 @@ discard block |
|
|
block discarded – undo |
|
792
|
792
|
$columnAlias = $this->getSQLColumnAlias($columnName); |
|
793
|
793
|
$columnType = PersisterHelper::getTypeOfColumn($joinColumn['referencedColumnName'], $targetClass, $this->em); |
|
794
|
794
|
|
|
795
|
|
- $sqlSelectExpressions[] = $sqlTableAlias . '.' . $columnName . ' AS ' . $columnAlias; |
|
|
795
|
+ $sqlSelectExpressions[] = $sqlTableAlias.'.'.$columnName.' AS '.$columnAlias; |
|
796
|
796
|
|
|
797
|
797
|
$this->rsm->addMetaResult($dqlAlias, $columnAlias, $columnName, $subClass->isIdentifier($columnName), $columnType); |
|
798
|
798
|
} |
|
@@ -818,7 +818,7 @@ discard block |
|
|
block discarded – undo |
|
818
|
818
|
$sqlParts[] = $this->walkIdentificationVariableDeclaration($identificationVariableDecl); |
|
819
|
819
|
} |
|
820
|
820
|
|
|
821
|
|
- return ' FROM ' . implode(', ', $sqlParts); |
|
|
821
|
+ return ' FROM '.implode(', ', $sqlParts); |
|
822
|
822
|
} |
|
823
|
823
|
|
|
824
|
824
|
/** |
|
@@ -882,7 +882,7 @@ discard block |
|
|
block discarded – undo |
|
882
|
882
|
} |
|
883
|
883
|
|
|
884
|
884
|
$sql = $this->platform->appendLockHint( |
|
885
|
|
- $this->quoteStrategy->getTableName($class, $this->platform) . ' ' . |
|
|
885
|
+ $this->quoteStrategy->getTableName($class, $this->platform).' '. |
|
886
|
886
|
$this->getSQLTableAlias($class->getTableName(), $dqlAlias), |
|
887
|
887
|
$this->query->getHint(Query::HINT_LOCK_MODE) |
|
888
|
888
|
); |
|
@@ -924,7 +924,7 @@ discard block |
|
|
block discarded – undo |
|
924
|
924
|
// Ensure we got the owning side, since it has all mapping info |
|
925
|
925
|
$assoc = ( ! $relation['isOwningSide']) ? $targetClass->associationMappings[$relation['mappedBy']] : $relation; |
|
926
|
926
|
|
|
927
|
|
- if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && (!$this->query->getHint(self::HINT_DISTINCT) || isset($this->selectedClasses[$joinedDqlAlias]))) { |
|
|
927
|
+ if ($this->query->getHint(Query::HINT_INTERNAL_ITERATION) == true && ( ! $this->query->getHint(self::HINT_DISTINCT) || isset($this->selectedClasses[$joinedDqlAlias]))) { |
|
928
|
928
|
if ($relation['type'] == ClassMetadata::ONE_TO_MANY || $relation['type'] == ClassMetadata::MANY_TO_MANY) { |
|
929
|
929
|
throw QueryException::iterateWithFetchJoinNotAllowed($assoc); |
|
930
|
930
|
} |
|
@@ -944,12 +944,12 @@ discard block |
|
|
block discarded – undo |
|
944
|
944
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
945
|
945
|
|
|
946
|
946
|
if ($relation['isOwningSide']) { |
|
947
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedSourceColumn . ' = ' . $targetTableAlias . '.' . $quotedTargetColumn; |
|
|
947
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedSourceColumn.' = '.$targetTableAlias.'.'.$quotedTargetColumn; |
|
948
|
948
|
|
|
949
|
949
|
continue; |
|
950
|
950
|
} |
|
951
|
951
|
|
|
952
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $targetTableAlias . '.' . $quotedSourceColumn; |
|
|
952
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$targetTableAlias.'.'.$quotedSourceColumn; |
|
953
|
953
|
} |
|
954
|
954
|
|
|
955
|
955
|
// Apply remaining inheritance restrictions |
|
@@ -967,7 +967,7 @@ discard block |
|
|
block discarded – undo |
|
967
|
967
|
} |
|
968
|
968
|
|
|
969
|
969
|
$targetTableJoin = [ |
|
970
|
|
- 'table' => $targetTableName . ' ' . $targetTableAlias, |
|
|
970
|
+ 'table' => $targetTableName.' '.$targetTableAlias, |
|
971
|
971
|
'condition' => implode(' AND ', $conditions), |
|
972
|
972
|
]; |
|
973
|
973
|
break; |
|
@@ -987,10 +987,10 @@ discard block |
|
|
block discarded – undo |
|
987
|
987
|
$quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
988
|
988
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
989
|
989
|
|
|
990
|
|
- $conditions[] = $sourceTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
|
990
|
+ $conditions[] = $sourceTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableAlias.'.'.$quotedSourceColumn; |
|
991
|
991
|
} |
|
992
|
992
|
|
|
993
|
|
- $sql .= $joinTableName . ' ' . $joinTableAlias . ' ON ' . implode(' AND ', $conditions); |
|
|
993
|
+ $sql .= $joinTableName.' '.$joinTableAlias.' ON '.implode(' AND ', $conditions); |
|
994
|
994
|
|
|
995
|
995
|
// Join target table |
|
996
|
996
|
$sql .= ($joinType == AST\Join::JOIN_TYPE_LEFT || $joinType == AST\Join::JOIN_TYPE_LEFTOUTER) ? ' LEFT JOIN ' : ' INNER JOIN '; |
|
@@ -1004,7 +1004,7 @@ discard block |
|
|
block discarded – undo |
|
1004
|
1004
|
$quotedSourceColumn = $this->quoteStrategy->getJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
1005
|
1005
|
$quotedTargetColumn = $this->quoteStrategy->getReferencedJoinColumnName($joinColumn, $targetClass, $this->platform); |
|
1006
|
1006
|
|
|
1007
|
|
- $conditions[] = $targetTableAlias . '.' . $quotedTargetColumn . ' = ' . $joinTableAlias . '.' . $quotedSourceColumn; |
|
|
1007
|
+ $conditions[] = $targetTableAlias.'.'.$quotedTargetColumn.' = '.$joinTableAlias.'.'.$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; |
|
@@ -1032,22 +1032,22 @@ discard block |
|
|
block discarded – undo |
|
1032
|
1032
|
} |
|
1033
|
1033
|
|
|
1034
|
1034
|
// Handle WITH clause |
|
1035
|
|
- $withCondition = (null === $condExpr) ? '' : ('(' . $this->walkConditionalExpression($condExpr) . ')'); |
|
|
1035
|
+ $withCondition = (null === $condExpr) ? '' : ('('.$this->walkConditionalExpression($condExpr).')'); |
|
1036
|
1036
|
|
|
1037
|
1037
|
if ($targetClass->isInheritanceTypeJoined()) { |
|
1038
|
1038
|
$ctiJoins = $this->_generateClassTableInheritanceJoins($targetClass, $joinedDqlAlias); |
|
1039
|
1039
|
// If we have WITH condition, we need to build nested joins for target class table and cti joins |
|
1040
|
1040
|
if ($withCondition) { |
|
1041
|
|
- $sql .= '(' . $targetTableJoin['table'] . $ctiJoins . ') ON ' . $targetTableJoin['condition']; |
|
|
1041
|
+ $sql .= '('.$targetTableJoin['table'].$ctiJoins.') ON '.$targetTableJoin['condition']; |
|
1042
|
1042
|
} else { |
|
1043
|
|
- $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition'] . $ctiJoins; |
|
|
1043
|
+ $sql .= $targetTableJoin['table'].' ON '.$targetTableJoin['condition'].$ctiJoins; |
|
1044
|
1044
|
} |
|
1045
|
1045
|
} else { |
|
1046
|
|
- $sql .= $targetTableJoin['table'] . ' ON ' . $targetTableJoin['condition']; |
|
|
1046
|
+ $sql .= $targetTableJoin['table'].' ON '.$targetTableJoin['condition']; |
|
1047
|
1047
|
} |
|
1048
|
1048
|
|
|
1049
|
1049
|
if ($withCondition) { |
|
1050
|
|
- $sql .= ' AND ' . $withCondition; |
|
|
1050
|
+ $sql .= ' AND '.$withCondition; |
|
1051
|
1051
|
} |
|
1052
|
1052
|
|
|
1053
|
1053
|
// Apply the indexes |
|
@@ -1080,7 +1080,7 @@ discard block |
|
|
block discarded – undo |
|
1080
|
1080
|
$orderByItems = array_merge($orderByItems, (array) $collectionOrderByItems); |
|
1081
|
1081
|
} |
|
1082
|
1082
|
|
|
1083
|
|
- return ' ORDER BY ' . implode(', ', $orderByItems); |
|
|
1083
|
+ return ' ORDER BY '.implode(', ', $orderByItems); |
|
1084
|
1084
|
} |
|
1085
|
1085
|
|
|
1086
|
1086
|
/** |
|
@@ -1097,10 +1097,10 @@ discard block |
|
|
block discarded – undo |
|
1097
|
1097
|
$this->orderedColumnsMap[$sql] = $type; |
|
1098
|
1098
|
|
|
1099
|
1099
|
if ($expr instanceof AST\Subselect) { |
|
1100
|
|
- return '(' . $sql . ') ' . $type; |
|
|
1100
|
+ return '('.$sql.') '.$type; |
|
1101
|
1101
|
} |
|
1102
|
1102
|
|
|
1103
|
|
- return $sql . ' ' . $type; |
|
|
1103
|
+ return $sql.' '.$type; |
|
1104
|
1104
|
} |
|
1105
|
1105
|
|
|
1106
|
1106
|
/** |
|
@@ -1108,7 +1108,7 @@ discard block |
|
|
block discarded – undo |
|
1108
|
1108
|
*/ |
|
1109
|
1109
|
public function walkHavingClause($havingClause) |
|
1110
|
1110
|
{ |
|
1111
|
|
- return ' HAVING ' . $this->walkConditionalExpression($havingClause->conditionalExpression); |
|
|
1111
|
+ return ' HAVING '.$this->walkConditionalExpression($havingClause->conditionalExpression); |
|
1112
|
1112
|
} |
|
1113
|
1113
|
|
|
1114
|
1114
|
/** |
|
@@ -1131,7 +1131,7 @@ discard block |
|
|
block discarded – undo |
|
1131
|
1131
|
$conditions = []; |
|
1132
|
1132
|
|
|
1133
|
1133
|
if ($join->conditionalExpression) { |
|
1134
|
|
- $conditions[] = '(' . $this->walkConditionalExpression($join->conditionalExpression) . ')'; |
|
|
1134
|
+ $conditions[] = '('.$this->walkConditionalExpression($join->conditionalExpression).')'; |
|
1135
|
1135
|
} |
|
1136
|
1136
|
|
|
1137
|
1137
|
$condExprConjunction = ($class->isInheritanceTypeJoined() && $joinType != AST\Join::JOIN_TYPE_LEFT && $joinType != AST\Join::JOIN_TYPE_LEFTOUTER) |
|
@@ -1155,7 +1155,7 @@ discard block |
|
|
block discarded – undo |
|
1155
|
1155
|
} |
|
1156
|
1156
|
|
|
1157
|
1157
|
if ($conditions) { |
|
1158
|
|
- $sql .= $condExprConjunction . implode(' AND ', $conditions); |
|
|
1158
|
+ $sql .= $condExprConjunction.implode(' AND ', $conditions); |
|
1159
|
1159
|
} |
|
1160
|
1160
|
|
|
1161
|
1161
|
break; |
|
@@ -1185,7 +1185,7 @@ discard block |
|
|
block discarded – undo |
|
1185
|
1185
|
$scalarExpressions[] = $this->walkSimpleArithmeticExpression($scalarExpression); |
|
1186
|
1186
|
} |
|
1187
|
1187
|
|
|
1188
|
|
- $sql .= implode(', ', $scalarExpressions) . ')'; |
|
|
1188
|
+ $sql .= implode(', ', $scalarExpressions).')'; |
|
1189
|
1189
|
|
|
1190
|
1190
|
return $sql; |
|
1191
|
1191
|
} |
|
@@ -1207,7 +1207,7 @@ discard block |
|
|
block discarded – undo |
|
1207
|
1207
|
? $this->conn->quote($nullIfExpression->secondExpression) |
|
1208
|
1208
|
: $this->walkSimpleArithmeticExpression($nullIfExpression->secondExpression); |
|
1209
|
1209
|
|
|
1210
|
|
- return 'NULLIF(' . $firstExpression . ', ' . $secondExpression . ')'; |
|
|
1210
|
+ return 'NULLIF('.$firstExpression.', '.$secondExpression.')'; |
|
1211
|
1211
|
} |
|
1212
|
1212
|
|
|
1213
|
1213
|
/** |
|
@@ -1222,11 +1222,11 @@ discard block |
|
|
block discarded – undo |
|
1222
|
1222
|
$sql = 'CASE'; |
|
1223
|
1223
|
|
|
1224
|
1224
|
foreach ($generalCaseExpression->whenClauses as $whenClause) { |
|
1225
|
|
- $sql .= ' WHEN ' . $this->walkConditionalExpression($whenClause->caseConditionExpression); |
|
1226
|
|
- $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
|
|
1225
|
+ $sql .= ' WHEN '.$this->walkConditionalExpression($whenClause->caseConditionExpression); |
|
|
1226
|
+ $sql .= ' THEN '.$this->walkSimpleArithmeticExpression($whenClause->thenScalarExpression); |
|
1227
|
1227
|
} |
|
1228
|
1228
|
|
|
1229
|
|
- $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression) . ' END'; |
|
|
1229
|
+ $sql .= ' ELSE '.$this->walkSimpleArithmeticExpression($generalCaseExpression->elseScalarExpression).' END'; |
|
1230
|
1230
|
|
|
1231
|
1231
|
return $sql; |
|
1232
|
1232
|
} |
|
@@ -1240,14 +1240,14 @@ discard block |
|
|
block discarded – undo |
|
1240
|
1240
|
*/ |
|
1241
|
1241
|
public function walkSimpleCaseExpression($simpleCaseExpression) |
|
1242
|
1242
|
{ |
|
1243
|
|
- $sql = 'CASE ' . $this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
|
|
1243
|
+ $sql = 'CASE '.$this->walkStateFieldPathExpression($simpleCaseExpression->caseOperand); |
|
1244
|
1244
|
|
|
1245
|
1245
|
foreach ($simpleCaseExpression->simpleWhenClauses as $simpleWhenClause) { |
|
1246
|
|
- $sql .= ' WHEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
|
1247
|
|
- $sql .= ' THEN ' . $this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
|
|
1246
|
+ $sql .= ' WHEN '.$this->walkSimpleArithmeticExpression($simpleWhenClause->caseScalarExpression); |
|
|
1247
|
+ $sql .= ' THEN '.$this->walkSimpleArithmeticExpression($simpleWhenClause->thenScalarExpression); |
|
1248
|
1248
|
} |
|
1249
|
1249
|
|
|
1250
|
|
- $sql .= ' ELSE ' . $this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression) . ' END'; |
|
|
1250
|
+ $sql .= ' ELSE '.$this->walkSimpleArithmeticExpression($simpleCaseExpression->elseScalarExpression).' END'; |
|
1251
|
1251
|
|
|
1252
|
1252
|
return $sql; |
|
1253
|
1253
|
} |
|
@@ -1281,14 +1281,14 @@ discard block |
|
|
block discarded – undo |
|
1281
|
1281
|
$fieldMapping = $class->fieldMappings[$fieldName]; |
|
1282
|
1282
|
$columnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
|
1283
|
1283
|
$columnAlias = $this->getSQLColumnAlias($fieldMapping['columnName']); |
|
1284
|
|
- $col = $sqlTableAlias . '.' . $columnName; |
|
|
1284
|
+ $col = $sqlTableAlias.'.'.$columnName; |
|
1285
|
1285
|
|
|
1286
|
1286
|
if (isset($fieldMapping['requireSQLConversion'])) { |
|
1287
|
1287
|
$type = Type::getType($fieldMapping['type']); |
|
1288
|
1288
|
$col = $type->convertToPHPValueSQL($col, $this->conn->getDatabasePlatform()); |
|
1289
|
1289
|
} |
|
1290
|
1290
|
|
|
1291
|
|
- $sql .= $col . ' AS ' . $columnAlias; |
|
|
1291
|
+ $sql .= $col.' AS '.$columnAlias; |
|
1292
|
1292
|
|
|
1293
|
1293
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
|
1294
|
1294
|
|
|
@@ -1313,7 +1313,7 @@ discard block |
|
|
block discarded – undo |
|
1313
|
1313
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
|
1314
|
1314
|
$resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
|
1315
|
1315
|
|
|
1316
|
|
- $sql .= $expr->dispatch($this) . ' AS ' . $columnAlias; |
|
|
1316
|
+ $sql .= $expr->dispatch($this).' AS '.$columnAlias; |
|
1317
|
1317
|
|
|
1318
|
1318
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
|
1319
|
1319
|
|
|
@@ -1327,7 +1327,7 @@ discard block |
|
|
block discarded – undo |
|
1327
|
1327
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
|
1328
|
1328
|
$resultAlias = $selectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
|
1329
|
1329
|
|
|
1330
|
|
- $sql .= '(' . $this->walkSubselect($expr) . ') AS ' . $columnAlias; |
|
|
1330
|
+ $sql .= '('.$this->walkSubselect($expr).') AS '.$columnAlias; |
|
1331
|
1331
|
|
|
1332
|
1332
|
$this->scalarResultAliasMap[$resultAlias] = $columnAlias; |
|
1333
|
1333
|
|
|
@@ -1338,7 +1338,7 @@ discard block |
|
|
block discarded – undo |
|
1338
|
1338
|
break; |
|
1339
|
1339
|
|
|
1340
|
1340
|
case ($expr instanceof AST\NewObjectExpression): |
|
1341
|
|
- $sql .= $this->walkNewObject($expr,$selectExpression->fieldIdentificationVariable); |
|
|
1341
|
+ $sql .= $this->walkNewObject($expr, $selectExpression->fieldIdentificationVariable); |
|
1342
|
1342
|
break; |
|
1343
|
1343
|
|
|
1344
|
1344
|
default: |
|
@@ -1379,14 +1379,14 @@ discard block |
|
|
block discarded – undo |
|
1379
|
1379
|
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
|
1380
|
1380
|
$quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $class, $this->platform); |
|
1381
|
1381
|
|
|
1382
|
|
- $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
|
1382
|
+ $col = $sqlTableAlias.'.'.$quotedColumnName; |
|
1383
|
1383
|
|
|
1384
|
1384
|
if (isset($mapping['requireSQLConversion'])) { |
|
1385
|
1385
|
$type = Type::getType($mapping['type']); |
|
1386
|
1386
|
$col = $type->convertToPHPValueSQL($col, $this->platform); |
|
1387
|
1387
|
} |
|
1388
|
1388
|
|
|
1389
|
|
- $sqlParts[] = $col . ' AS '. $columnAlias; |
|
|
1389
|
+ $sqlParts[] = $col.' AS '.$columnAlias; |
|
1390
|
1390
|
|
|
1391
|
1391
|
$this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
|
1392
|
1392
|
|
|
@@ -1403,21 +1403,21 @@ discard block |
|
|
block discarded – undo |
|
1403
|
1403
|
$sqlTableAlias = $this->getSQLTableAlias($subClass->getTableName(), $dqlAlias); |
|
1404
|
1404
|
|
|
1405
|
1405
|
foreach ($subClass->fieldMappings as $fieldName => $mapping) { |
|
1406
|
|
- if (isset($mapping['inherited']) || ($partialFieldSet && !in_array($fieldName, $partialFieldSet))) { |
|
|
1406
|
+ if (isset($mapping['inherited']) || ($partialFieldSet && ! in_array($fieldName, $partialFieldSet))) { |
|
1407
|
1407
|
continue; |
|
1408
|
1408
|
} |
|
1409
|
1409
|
|
|
1410
|
1410
|
$columnAlias = $this->getSQLColumnAlias($mapping['columnName']); |
|
1411
|
1411
|
$quotedColumnName = $this->quoteStrategy->getColumnName($fieldName, $subClass, $this->platform); |
|
1412
|
1412
|
|
|
1413
|
|
- $col = $sqlTableAlias . '.' . $quotedColumnName; |
|
|
1413
|
+ $col = $sqlTableAlias.'.'.$quotedColumnName; |
|
1414
|
1414
|
|
|
1415
|
1415
|
if (isset($mapping['requireSQLConversion'])) { |
|
1416
|
1416
|
$type = Type::getType($mapping['type']); |
|
1417
|
1417
|
$col = $type->convertToPHPValueSQL($col, $this->platform); |
|
1418
|
1418
|
} |
|
1419
|
1419
|
|
|
1420
|
|
- $sqlParts[] = $col . ' AS ' . $columnAlias; |
|
|
1420
|
+ $sqlParts[] = $col.' AS '.$columnAlias; |
|
1421
|
1421
|
|
|
1422
|
1422
|
$this->scalarResultAliasMap[$resultAlias][] = $columnAlias; |
|
1423
|
1423
|
|
|
@@ -1437,7 +1437,7 @@ discard block |
|
|
block discarded – undo |
|
1437
|
1437
|
*/ |
|
1438
|
1438
|
public function walkQuantifiedExpression($qExpr) |
|
1439
|
1439
|
{ |
|
1440
|
|
- return ' ' . strtoupper($qExpr->type) . '(' . $this->walkSubselect($qExpr->subselect) . ')'; |
|
|
1440
|
+ return ' '.strtoupper($qExpr->type).'('.$this->walkSubselect($qExpr->subselect).')'; |
|
1441
|
1441
|
} |
|
1442
|
1442
|
|
|
1443
|
1443
|
/** |
|
@@ -1477,7 +1477,7 @@ discard block |
|
|
block discarded – undo |
|
1477
|
1477
|
$sqlParts[] = $this->walkIdentificationVariableDeclaration($subselectIdVarDecl); |
|
1478
|
1478
|
} |
|
1479
|
1479
|
|
|
1480
|
|
- return ' FROM ' . implode(', ', $sqlParts); |
|
|
1480
|
+ return ' FROM '.implode(', ', $sqlParts); |
|
1481
|
1481
|
} |
|
1482
|
1482
|
|
|
1483
|
1483
|
/** |
|
@@ -1485,7 +1485,7 @@ discard block |
|
|
block discarded – undo |
|
1485
|
1485
|
*/ |
|
1486
|
1486
|
public function walkSimpleSelectClause($simpleSelectClause) |
|
1487
|
1487
|
{ |
|
1488
|
|
- return 'SELECT' . ($simpleSelectClause->isDistinct ? ' DISTINCT' : '') |
|
|
1488
|
+ return 'SELECT'.($simpleSelectClause->isDistinct ? ' DISTINCT' : '') |
|
1489
|
1489
|
. $this->walkSimpleSelectExpression($simpleSelectClause->simpleSelectExpression); |
|
1490
|
1490
|
} |
|
1491
|
1491
|
|
|
@@ -1504,10 +1504,10 @@ discard block |
|
|
block discarded – undo |
|
1504
|
1504
|
* |
|
1505
|
1505
|
* @return string The SQL. |
|
1506
|
1506
|
*/ |
|
1507
|
|
- public function walkNewObject($newObjectExpression, $newObjectResultAlias=null) |
|
|
1507
|
+ public function walkNewObject($newObjectExpression, $newObjectResultAlias = null) |
|
1508
|
1508
|
{ |
|
1509
|
1509
|
$sqlSelectExpressions = []; |
|
1510
|
|
- $objIndex = $newObjectResultAlias?:$this->newObjectCounter++; |
|
|
1510
|
+ $objIndex = $newObjectResultAlias ?: $this->newObjectCounter++; |
|
1511
|
1511
|
|
|
1512
|
1512
|
foreach ($newObjectExpression->args as $argIndex => $e) { |
|
1513
|
1513
|
$resultAlias = $this->scalarResultCounter++; |
|
@@ -1520,7 +1520,7 @@ discard block |
|
|
block discarded – undo |
|
1520
|
1520
|
break; |
|
1521
|
1521
|
|
|
1522
|
1522
|
case ($e instanceof AST\Subselect): |
|
1523
|
|
- $sqlSelectExpressions[] = '(' . $e->dispatch($this) . ') AS ' . $columnAlias; |
|
|
1523
|
+ $sqlSelectExpressions[] = '('.$e->dispatch($this).') AS '.$columnAlias; |
|
1524
|
1524
|
break; |
|
1525
|
1525
|
|
|
1526
|
1526
|
case ($e instanceof AST\PathExpression): |
|
@@ -1529,7 +1529,7 @@ discard block |
|
|
block discarded – undo |
|
1529
|
1529
|
$class = $qComp['metadata']; |
|
1530
|
1530
|
$fieldType = $class->fieldMappings[$e->field]['type']; |
|
1531
|
1531
|
|
|
1532
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
|
1532
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
|
1533
|
1533
|
break; |
|
1534
|
1534
|
|
|
1535
|
1535
|
case ($e instanceof AST\Literal): |
|
@@ -1543,11 +1543,11 @@ discard block |
|
|
block discarded – undo |
|
1543
|
1543
|
break; |
|
1544
|
1544
|
} |
|
1545
|
1545
|
|
|
1546
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
|
1546
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
|
1547
|
1547
|
break; |
|
1548
|
1548
|
|
|
1549
|
1549
|
default: |
|
1550
|
|
- $sqlSelectExpressions[] = trim($e->dispatch($this)) . ' AS ' . $columnAlias; |
|
|
1550
|
+ $sqlSelectExpressions[] = trim($e->dispatch($this)).' AS '.$columnAlias; |
|
1551
|
1551
|
break; |
|
1552
|
1552
|
} |
|
1553
|
1553
|
|
|
@@ -1580,16 +1580,16 @@ discard block |
|
|
block discarded – undo |
|
1580
|
1580
|
case ($expr instanceof AST\AggregateExpression): |
|
1581
|
1581
|
$alias = $simpleSelectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
|
1582
|
1582
|
|
|
1583
|
|
- $sql .= $this->walkAggregateExpression($expr) . ' AS dctrn__' . $alias; |
|
|
1583
|
+ $sql .= $this->walkAggregateExpression($expr).' AS dctrn__'.$alias; |
|
1584
|
1584
|
break; |
|
1585
|
1585
|
|
|
1586
|
1586
|
case ($expr instanceof AST\Subselect): |
|
1587
|
1587
|
$alias = $simpleSelectExpression->fieldIdentificationVariable ?: $this->scalarResultCounter++; |
|
1588
|
1588
|
|
|
1589
|
|
- $columnAlias = 'sclr' . $this->aliasCounter++; |
|
|
1589
|
+ $columnAlias = 'sclr'.$this->aliasCounter++; |
|
1590
|
1590
|
$this->scalarResultAliasMap[$alias] = $columnAlias; |
|
1591
|
1591
|
|
|
1592
|
|
- $sql .= '(' . $this->walkSubselect($expr) . ') AS ' . $columnAlias; |
|
|
1592
|
+ $sql .= '('.$this->walkSubselect($expr).') AS '.$columnAlias; |
|
1593
|
1593
|
break; |
|
1594
|
1594
|
|
|
1595
|
1595
|
case ($expr instanceof AST\Functions\FunctionNode): |
|
@@ -1606,7 +1606,7 @@ discard block |
|
|
block discarded – undo |
|
1606
|
1606
|
$columnAlias = $this->getSQLColumnAlias('sclr'); |
|
1607
|
1607
|
$this->scalarResultAliasMap[$alias] = $columnAlias; |
|
1608
|
1608
|
|
|
1609
|
|
- $sql .= $expr->dispatch($this) . ' AS ' . $columnAlias; |
|
|
1609
|
+ $sql .= $expr->dispatch($this).' AS '.$columnAlias; |
|
1610
|
1610
|
break; |
|
1611
|
1611
|
|
|
1612
|
1612
|
case ($expr instanceof AST\ParenthesisExpression): |
|
@@ -1626,8 +1626,8 @@ discard block |
|
|
block discarded – undo |
|
1626
|
1626
|
*/ |
|
1627
|
1627
|
public function walkAggregateExpression($aggExpression) |
|
1628
|
1628
|
{ |
|
1629
|
|
- return $aggExpression->functionName . '(' . ($aggExpression->isDistinct ? 'DISTINCT ' : '') |
|
1630
|
|
- . $this->walkSimpleArithmeticExpression($aggExpression->pathExpression) . ')'; |
|
|
1629
|
+ return $aggExpression->functionName.'('.($aggExpression->isDistinct ? 'DISTINCT ' : '') |
|
|
1630
|
+ . $this->walkSimpleArithmeticExpression($aggExpression->pathExpression).')'; |
|
1631
|
1631
|
} |
|
1632
|
1632
|
|
|
1633
|
1633
|
/** |
|
@@ -1641,7 +1641,7 @@ discard block |
|
|
block discarded – undo |
|
1641
|
1641
|
$sqlParts[] = $this->walkGroupByItem($groupByItem); |
|
1642
|
1642
|
} |
|
1643
|
1643
|
|
|
1644
|
|
- return ' GROUP BY ' . implode(', ', $sqlParts); |
|
|
1644
|
+ return ' GROUP BY '.implode(', ', $sqlParts); |
|
1645
|
1645
|
} |
|
1646
|
1646
|
|
|
1647
|
1647
|
/** |
|
@@ -1698,7 +1698,7 @@ discard block |
|
|
block discarded – undo |
|
1698
|
1698
|
{ |
|
1699
|
1699
|
$class = $this->em->getClassMetadata($deleteClause->abstractSchemaName); |
|
1700
|
1700
|
$tableName = $class->getTableName(); |
|
1701
|
|
- $sql = 'DELETE FROM ' . $this->quoteStrategy->getTableName($class, $this->platform); |
|
|
1701
|
+ $sql = 'DELETE FROM '.$this->quoteStrategy->getTableName($class, $this->platform); |
|
1702
|
1702
|
|
|
1703
|
1703
|
$this->setSQLTableAlias($tableName, $tableName, $deleteClause->aliasIdentificationVariable); |
|
1704
|
1704
|
$this->rootAliases[] = $deleteClause->aliasIdentificationVariable; |
|
@@ -1713,12 +1713,12 @@ discard block |
|
|
block discarded – undo |
|
1713
|
1713
|
{ |
|
1714
|
1714
|
$class = $this->em->getClassMetadata($updateClause->abstractSchemaName); |
|
1715
|
1715
|
$tableName = $class->getTableName(); |
|
1716
|
|
- $sql = 'UPDATE ' . $this->quoteStrategy->getTableName($class, $this->platform); |
|
|
1716
|
+ $sql = 'UPDATE '.$this->quoteStrategy->getTableName($class, $this->platform); |
|
1717
|
1717
|
|
|
1718
|
1718
|
$this->setSQLTableAlias($tableName, $tableName, $updateClause->aliasIdentificationVariable); |
|
1719
|
1719
|
$this->rootAliases[] = $updateClause->aliasIdentificationVariable; |
|
1720
|
1720
|
|
|
1721
|
|
- $sql .= ' SET ' . implode(', ', array_map([$this, 'walkUpdateItem'], $updateClause->updateItems)); |
|
|
1721
|
+ $sql .= ' SET '.implode(', ', array_map([$this, 'walkUpdateItem'], $updateClause->updateItems)); |
|
1722
|
1722
|
|
|
1723
|
1723
|
return $sql; |
|
1724
|
1724
|
} |
|
@@ -1731,7 +1731,7 @@ discard block |
|
|
block discarded – undo |
|
1731
|
1731
|
$useTableAliasesBefore = $this->useSqlTableAliases; |
|
1732
|
1732
|
$this->useSqlTableAliases = false; |
|
1733
|
1733
|
|
|
1734
|
|
- $sql = $this->walkPathExpression($updateItem->pathExpression) . ' = '; |
|
|
1734
|
+ $sql = $this->walkPathExpression($updateItem->pathExpression).' = '; |
|
1735
|
1735
|
$newValue = $updateItem->newValue; |
|
1736
|
1736
|
|
|
1737
|
1737
|
switch (true) { |
|
@@ -1774,7 +1774,7 @@ discard block |
|
|
block discarded – undo |
|
1774
|
1774
|
|
|
1775
|
1775
|
if (count($filterClauses)) { |
|
1776
|
1776
|
if ($condSql) { |
|
1777
|
|
- $condSql = '(' . $condSql . ') AND '; |
|
|
1777
|
+ $condSql = '('.$condSql.') AND '; |
|
1778
|
1778
|
} |
|
1779
|
1779
|
|
|
1780
|
1780
|
$condSql .= implode(' AND ', $filterClauses); |
|
@@ -1782,11 +1782,11 @@ discard block |
|
|
block discarded – undo |
|
1782
|
1782
|
} |
|
1783
|
1783
|
|
|
1784
|
1784
|
if ($condSql) { |
|
1785
|
|
- return ' WHERE ' . (( ! $discrSql) ? $condSql : '(' . $condSql . ') AND ' . $discrSql); |
|
|
1785
|
+ return ' WHERE '.(( ! $discrSql) ? $condSql : '('.$condSql.') AND '.$discrSql); |
|
1786
|
1786
|
} |
|
1787
|
1787
|
|
|
1788
|
1788
|
if ($discrSql) { |
|
1789
|
|
- return ' WHERE ' . $discrSql; |
|
|
1789
|
+ return ' WHERE '.$discrSql; |
|
1790
|
1790
|
} |
|
1791
|
1791
|
|
|
1792
|
1792
|
return ''; |
|
@@ -1829,7 +1829,7 @@ discard block |
|
|
block discarded – undo |
|
1829
|
1829
|
// if only one ConditionalPrimary is defined |
|
1830
|
1830
|
return ( ! ($factor instanceof AST\ConditionalFactor)) |
|
1831
|
1831
|
? $this->walkConditionalPrimary($factor) |
|
1832
|
|
- : ($factor->not ? 'NOT ' : '') . $this->walkConditionalPrimary($factor->conditionalPrimary); |
|
|
1832
|
+ : ($factor->not ? 'NOT ' : '').$this->walkConditionalPrimary($factor->conditionalPrimary); |
|
1833
|
1833
|
} |
|
1834
|
1834
|
|
|
1835
|
1835
|
/** |
|
@@ -1844,7 +1844,7 @@ discard block |
|
|
block discarded – undo |
|
1844
|
1844
|
if ($primary->isConditionalExpression()) { |
|
1845
|
1845
|
$condExpr = $primary->conditionalExpression; |
|
1846
|
1846
|
|
|
1847
|
|
- return '(' . $this->walkConditionalExpression($condExpr) . ')'; |
|
|
1847
|
+ return '('.$this->walkConditionalExpression($condExpr).')'; |
|
1848
|
1848
|
} |
|
1849
|
1849
|
} |
|
1850
|
1850
|
|
|
@@ -1855,7 +1855,7 @@ discard block |
|
|
block discarded – undo |
|
1855
|
1855
|
{ |
|
1856
|
1856
|
$sql = ($existsExpr->not) ? 'NOT ' : ''; |
|
1857
|
1857
|
|
|
1858
|
|
- $sql .= 'EXISTS (' . $this->walkSubselect($existsExpr->subselect) . ')'; |
|
|
1858
|
+ $sql .= 'EXISTS ('.$this->walkSubselect($existsExpr->subselect).')'; |
|
1859
|
1859
|
|
|
1860
|
1860
|
return $sql; |
|
1861
|
1861
|
} |
|
@@ -1899,7 +1899,7 @@ discard block |
|
|
block discarded – undo |
|
1899
|
1899
|
$targetTableAlias = $this->getSQLTableAlias($targetClass->getTableName()); |
|
1900
|
1900
|
$sourceTableAlias = $this->getSQLTableAlias($class->getTableName(), $dqlAlias); |
|
1901
|
1901
|
|
|
1902
|
|
- $sql .= $this->quoteStrategy->getTableName($targetClass, $this->platform) . ' ' . $targetTableAlias . ' WHERE '; |
|
|
1902
|
+ $sql .= $this->quoteStrategy->getTableName($targetClass, $this->platform).' '.$targetTableAlias.' WHERE '; |
|
1903
|
1903
|
|
|
1904
|
1904
|
$owningAssoc = $targetClass->associationMappings[$assoc['mappedBy']]; |
|
1905
|
1905
|
$sqlParts = []; |
|
@@ -1907,7 +1907,7 @@ discard block |
|
|
block discarded – undo |
|
1907
|
1907
|
foreach ($owningAssoc['targetToSourceKeyColumns'] as $targetColumn => $sourceColumn) { |
|
1908
|
1908
|
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$targetColumn], $class, $this->platform); |
|
1909
|
1909
|
|
|
1910
|
|
- $sqlParts[] = $sourceTableAlias . '.' . $targetColumn . ' = ' . $targetTableAlias . '.' . $sourceColumn; |
|
|
1910
|
+ $sqlParts[] = $sourceTableAlias.'.'.$targetColumn.' = '.$targetTableAlias.'.'.$sourceColumn; |
|
1911
|
1911
|
} |
|
1912
|
1912
|
|
|
1913
|
1913
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($targetClass, $this->platform) as $targetColumnName) { |
|
@@ -1915,7 +1915,7 @@ discard block |
|
|
block discarded – undo |
|
1915
|
1915
|
$this->parserResult->addParameterMapping($dqlParamKey, $this->sqlParamIndex++); |
|
1916
|
1916
|
} |
|
1917
|
1917
|
|
|
1918
|
|
- $sqlParts[] = $targetTableAlias . '.' . $targetColumnName . ' = ' . $entitySql; |
|
|
1918
|
+ $sqlParts[] = $targetTableAlias.'.'.$targetColumnName.' = '.$entitySql; |
|
1919
|
1919
|
} |
|
1920
|
1920
|
|
|
1921
|
1921
|
$sql .= implode(' AND ', $sqlParts); |
|
@@ -1931,8 +1931,8 @@ discard block |
|
|
block discarded – undo |
|
1931
|
1931
|
$sourceTableAlias = $this->getSQLTableAlias($class->getTableName(), $dqlAlias); |
|
1932
|
1932
|
|
|
1933
|
1933
|
// join to target table |
|
1934
|
|
- $sql .= $this->quoteStrategy->getJoinTableName($owningAssoc, $targetClass, $this->platform) . ' ' . $joinTableAlias |
|
1935
|
|
- . ' INNER JOIN ' . $this->quoteStrategy->getTableName($targetClass, $this->platform) . ' ' . $targetTableAlias . ' ON '; |
|
|
1934
|
+ $sql .= $this->quoteStrategy->getJoinTableName($owningAssoc, $targetClass, $this->platform).' '.$joinTableAlias |
|
|
1935
|
+ . ' INNER JOIN '.$this->quoteStrategy->getTableName($targetClass, $this->platform).' '.$targetTableAlias.' ON '; |
|
1936
|
1936
|
|
|
1937
|
1937
|
// join conditions |
|
1938
|
1938
|
$joinColumns = $assoc['isOwningSide'] ? $joinTable['inverseJoinColumns'] : $joinTable['joinColumns']; |
|
@@ -1941,7 +1941,7 @@ discard block |
|
|
block discarded – undo |
|
1941
|
1941
|
foreach ($joinColumns as $joinColumn) { |
|
1942
|
1942
|
$targetColumn = $this->quoteStrategy->getColumnName($targetClass->fieldNames[$joinColumn['referencedColumnName']], $targetClass, $this->platform); |
|
1943
|
1943
|
|
|
1944
|
|
- $joinSqlParts[] = $joinTableAlias . '.' . $joinColumn['name'] . ' = ' . $targetTableAlias . '.' . $targetColumn; |
|
|
1944
|
+ $joinSqlParts[] = $joinTableAlias.'.'.$joinColumn['name'].' = '.$targetTableAlias.'.'.$targetColumn; |
|
1945
|
1945
|
} |
|
1946
|
1946
|
|
|
1947
|
1947
|
$sql .= implode(' AND ', $joinSqlParts); |
|
@@ -1953,7 +1953,7 @@ discard block |
|
|
block discarded – undo |
|
1953
|
1953
|
foreach ($joinColumns as $joinColumn) { |
|
1954
|
1954
|
$targetColumn = $this->quoteStrategy->getColumnName($class->fieldNames[$joinColumn['referencedColumnName']], $class, $this->platform); |
|
1955
|
1955
|
|
|
1956
|
|
- $sqlParts[] = $joinTableAlias . '.' . $joinColumn['name'] . ' = ' . $sourceTableAlias . '.' . $targetColumn; |
|
|
1956
|
+ $sqlParts[] = $joinTableAlias.'.'.$joinColumn['name'].' = '.$sourceTableAlias.'.'.$targetColumn; |
|
1957
|
1957
|
} |
|
1958
|
1958
|
|
|
1959
|
1959
|
foreach ($this->quoteStrategy->getIdentifierColumnNames($targetClass, $this->platform) as $targetColumnName) { |
|
@@ -1961,13 +1961,13 @@ discard block |
|
|
block discarded – undo |
|
1961
|
1961
|
$this->parserResult->addParameterMapping($dqlParamKey, $this->sqlParamIndex++); |
|
1962
|
1962
|
} |
|
1963
|
1963
|
|
|
1964
|
|
- $sqlParts[] = $targetTableAlias . '.' . $targetColumnName . ' IN (' . $entitySql . ')'; |
|
|
1964
|
+ $sqlParts[] = $targetTableAlias.'.'.$targetColumnName.' IN ('.$entitySql.')'; |
|
1965
|
1965
|
} |
|
1966
|
1966
|
|
|
1967
|
1967
|
$sql .= implode(' AND ', $sqlParts); |
|
1968
|
1968
|
} |
|
1969
|
1969
|
|
|
1970
|
|
- return $sql . ')'; |
|
|
1970
|
+ return $sql.')'; |
|
1971
|
1971
|
} |
|
1972
|
1972
|
|
|
1973
|
1973
|
/** |
|
@@ -1978,7 +1978,7 @@ discard block |
|
|
block discarded – undo |
|
1978
|
1978
|
$sizeFunc = new AST\Functions\SizeFunction('size'); |
|
1979
|
1979
|
$sizeFunc->collectionPathExpression = $emptyCollCompExpr->expression; |
|
1980
|
1980
|
|
|
1981
|
|
- return $sizeFunc->getSql($this) . ($emptyCollCompExpr->not ? ' > 0' : ' = 0'); |
|
|
1981
|
+ return $sizeFunc->getSql($this).($emptyCollCompExpr->not ? ' > 0' : ' = 0'); |
|
1982
|
1982
|
} |
|
1983
|
1983
|
|
|
1984
|
1984
|
/** |
|
@@ -1987,19 +1987,19 @@ discard block |
|
|
block discarded – undo |
|
1987
|
1987
|
public function walkNullComparisonExpression($nullCompExpr) |
|
1988
|
1988
|
{ |
|
1989
|
1989
|
$expression = $nullCompExpr->expression; |
|
1990
|
|
- $comparison = ' IS' . ($nullCompExpr->not ? ' NOT' : '') . ' NULL'; |
|
|
1990
|
+ $comparison = ' IS'.($nullCompExpr->not ? ' NOT' : '').' NULL'; |
|
1991
|
1991
|
|
|
1992
|
1992
|
// Handle ResultVariable |
|
1993
|
1993
|
if (is_string($expression) && isset($this->queryComponents[$expression]['resultVariable'])) { |
|
1994
|
|
- return $this->walkResultVariable($expression) . $comparison; |
|
|
1994
|
+ return $this->walkResultVariable($expression).$comparison; |
|
1995
|
1995
|
} |
|
1996
|
1996
|
|
|
1997
|
1997
|
// Handle InputParameter mapping inclusion to ParserResult |
|
1998
|
1998
|
if ($expression instanceof AST\InputParameter) { |
|
1999
|
|
- return $this->walkInputParameter($expression) . $comparison; |
|
|
1999
|
+ return $this->walkInputParameter($expression).$comparison; |
|
2000
|
2000
|
} |
|
2001
|
2001
|
|
|
2002
|
|
- return $expression->dispatch($this) . $comparison; |
|
|
2002
|
+ return $expression->dispatch($this).$comparison; |
|
2003
|
2003
|
} |
|
2004
|
2004
|
|
|
2005
|
2005
|
/** |
|
@@ -2007,7 +2007,7 @@ discard block |
|
|
block discarded – undo |
|
2007
|
2007
|
*/ |
|
2008
|
2008
|
public function walkInExpression($inExpr) |
|
2009
|
2009
|
{ |
|
2010
|
|
- $sql = $this->walkArithmeticExpression($inExpr->expression) . ($inExpr->not ? ' NOT' : '') . ' IN ('; |
|
|
2010
|
+ $sql = $this->walkArithmeticExpression($inExpr->expression).($inExpr->not ? ' NOT' : '').' IN ('; |
|
2011
|
2011
|
|
|
2012
|
2012
|
$sql .= ($inExpr->subselect) |
|
2013
|
2013
|
? $this->walkSubselect($inExpr->subselect) |
|
@@ -2033,10 +2033,10 @@ discard block |
|
|
block discarded – undo |
|
2033
|
2033
|
} |
|
2034
|
2034
|
|
|
2035
|
2035
|
if ($this->useSqlTableAliases) { |
|
2036
|
|
- $sql .= $this->getSQLTableAlias($discrClass->getTableName(), $dqlAlias) . '.'; |
|
|
2036
|
+ $sql .= $this->getSQLTableAlias($discrClass->getTableName(), $dqlAlias).'.'; |
|
2037
|
2037
|
} |
|
2038
|
2038
|
|
|
2039
|
|
- $sql .= $class->discriminatorColumn['name'] . ($instanceOfExpr->not ? ' NOT IN ' : ' IN '); |
|
|
2039
|
+ $sql .= $class->discriminatorColumn['name'].($instanceOfExpr->not ? ' NOT IN ' : ' IN '); |
|
2040
|
2040
|
|
|
2041
|
2041
|
$knownSubclasses = array_flip($discrClass->subClasses); |
|
2042
|
2042
|
|
|
@@ -2078,7 +2078,7 @@ discard block |
|
|
block discarded – undo |
|
2078
|
2078
|
$sqlParameterList[] = $this->conn->quote($dis); |
|
2079
|
2079
|
} |
|
2080
|
2080
|
|
|
2081
|
|
- $sql .= '(' . implode(', ', $sqlParameterList) . ')'; |
|
|
2081
|
+ $sql .= '('.implode(', ', $sqlParameterList).')'; |
|
2082
|
2082
|
|
|
2083
|
2083
|
return $sql; |
|
2084
|
2084
|
} |
|
@@ -2124,8 +2124,8 @@ discard block |
|
|
block discarded – undo |
|
2124
|
2124
|
$sql .= ' NOT'; |
|
2125
|
2125
|
} |
|
2126
|
2126
|
|
|
2127
|
|
- $sql .= ' BETWEEN ' . $this->walkArithmeticExpression($betweenExpr->leftBetweenExpression) |
|
2128
|
|
- . ' AND ' . $this->walkArithmeticExpression($betweenExpr->rightBetweenExpression); |
|
|
2127
|
+ $sql .= ' BETWEEN '.$this->walkArithmeticExpression($betweenExpr->leftBetweenExpression) |
|
|
2128
|
+ . ' AND '.$this->walkArithmeticExpression($betweenExpr->rightBetweenExpression); |
|
2129
|
2129
|
|
|
2130
|
2130
|
return $sql; |
|
2131
|
2131
|
} |
|
@@ -2140,7 +2140,7 @@ discard block |
|
|
block discarded – undo |
|
2140
|
2140
|
? $this->walkResultVariable($stringExpr) |
|
2141
|
2141
|
: $stringExpr->dispatch($this); |
|
2142
|
2142
|
|
|
2143
|
|
- $sql = $leftExpr . ($likeExpr->not ? ' NOT' : '') . ' LIKE '; |
|
|
2143
|
+ $sql = $leftExpr.($likeExpr->not ? ' NOT' : '').' LIKE '; |
|
2144
|
2144
|
|
|
2145
|
2145
|
if ($likeExpr->stringPattern instanceof AST\InputParameter) { |
|
2146
|
2146
|
$sql .= $this->walkInputParameter($likeExpr->stringPattern); |
|
@@ -2153,7 +2153,7 @@ discard block |
|
|
block discarded – undo |
|
2153
|
2153
|
} |
|
2154
|
2154
|
|
|
2155
|
2155
|
if ($likeExpr->escapeChar) { |
|
2156
|
|
- $sql .= ' ESCAPE ' . $this->walkLiteral($likeExpr->escapeChar); |
|
|
2156
|
+ $sql .= ' ESCAPE '.$this->walkLiteral($likeExpr->escapeChar); |
|
2157
|
2157
|
} |
|
2158
|
2158
|
|
|
2159
|
2159
|
return $sql; |
|
@@ -2180,7 +2180,7 @@ discard block |
|
|
block discarded – undo |
|
2180
|
2180
|
? $leftExpr->dispatch($this) |
|
2181
|
2181
|
: (is_numeric($leftExpr) ? $leftExpr : $this->conn->quote($leftExpr)); |
|
2182
|
2182
|
|
|
2183
|
|
- $sql .= ' ' . $compExpr->operator . ' '; |
|
|
2183
|
+ $sql .= ' '.$compExpr->operator.' '; |
|
2184
|
2184
|
|
|
2185
|
2185
|
$sql .= ($rightExpr instanceof AST\Node) |
|
2186
|
2186
|
? $rightExpr->dispatch($this) |
|
@@ -2212,7 +2212,7 @@ discard block |
|
|
block discarded – undo |
|
2212
|
2212
|
{ |
|
2213
|
2213
|
return ($arithmeticExpr->isSimpleArithmeticExpression()) |
|
2214
|
2214
|
? $this->walkSimpleArithmeticExpression($arithmeticExpr->simpleArithmeticExpression) |
|
2215
|
|
- : '(' . $this->walkSubselect($arithmeticExpr->subselect) . ')'; |
|
|
2215
|
+ : '('.$this->walkSubselect($arithmeticExpr->subselect).')'; |
|
2216
|
2216
|
} |
|
2217
|
2217
|
|
|
2218
|
2218
|
/** |
|
@@ -2266,7 +2266,7 @@ discard block |
|
|
block discarded – undo |
|
2266
|
2266
|
|
|
2267
|
2267
|
$sign = $factor->isNegativeSigned() ? '-' : ($factor->isPositiveSigned() ? '+' : ''); |
|
2268
|
2268
|
|
|
2269
|
|
- return $sign . $this->walkArithmeticPrimary($factor->arithmeticPrimary); |
|
|
2269
|
+ return $sign.$this->walkArithmeticPrimary($factor->arithmeticPrimary); |
|
2270
|
2270
|
} |
|
2271
|
2271
|
|
|
2272
|
2272
|
/** |
|
@@ -2279,7 +2279,7 @@ discard block |
|
|
block discarded – undo |
|
2279
|
2279
|
public function walkArithmeticPrimary($primary) |
|
2280
|
2280
|
{ |
|
2281
|
2281
|
if ($primary instanceof AST\SimpleArithmeticExpression) { |
|
2282
|
|
- return '(' . $this->walkSimpleArithmeticExpression($primary) . ')'; |
|
|
2282
|
+ return '('.$this->walkSimpleArithmeticExpression($primary).')'; |
|
2283
|
2283
|
} |
|
2284
|
2284
|
|
|
2285
|
2285
|
if ($primary instanceof AST\Node) { |