|
@@ -127,7 +127,7 @@ discard block |
|
|
block discarded – undo |
|
127
|
127
|
$fieldNames = array_keys($identifier); |
|
128
|
128
|
$suffixedFieldNames = []; |
|
129
|
129
|
foreach ($fieldNames as $fieldName) { |
|
130
|
|
- $suffixedFieldNames[] = $fieldName . '=?'; |
|
|
130
|
+ $suffixedFieldNames[] = $fieldName.'=?'; |
|
131
|
131
|
} |
|
132
|
132
|
return implode(' AND ', $suffixedFieldNames); |
|
133
|
133
|
} |
|
@@ -188,7 +188,7 @@ discard block |
|
|
block discarded – undo |
|
188
|
188
|
if (isset($statementParts['keywords']['distinct'])) { |
|
189
|
189
|
unset($statementParts['keywords']['distinct']); |
|
190
|
190
|
$distinctField = $this->query->getDistinct() ? $this->query->getDistinct() : 'uid'; |
|
191
|
|
- $statementParts['fields'] = array('COUNT(DISTINCT ' . reset($statementParts['tables']) . '.' . $distinctField . ')'); |
|
|
191
|
+ $statementParts['fields'] = array('COUNT(DISTINCT '.reset($statementParts['tables']).'.'.$distinctField.')'); |
|
192
|
192
|
} |
|
193
|
193
|
|
|
194
|
194
|
$statement = $this->buildQuery($statementParts); |
|
@@ -258,14 +258,14 @@ discard block |
|
|
block discarded – undo |
|
258
|
258
|
// tx_domain_model_foo0 (the alias) <--> tx_domain_model_foo (the origin table name) |
|
259
|
259
|
$values = []; |
|
260
|
260
|
foreach ($statementParts['fields'] as $key => $value) { |
|
261
|
|
- $values[$key] = str_replace($tableName, $tableName . '0', $value); |
|
|
261
|
+ $values[$key] = str_replace($tableName, $tableName.'0', $value); |
|
262
|
262
|
} |
|
263
|
263
|
$statementParts['fields'] = $values; |
|
264
|
264
|
|
|
265
|
265
|
// Same comment as above. |
|
266
|
266
|
$values = []; |
|
267
|
267
|
foreach ($statementParts['where'] as $key => $value) { |
|
268
|
|
- $values[$key] = str_replace($tableName . '0', $tableName, $value); |
|
|
268
|
+ $values[$key] = str_replace($tableName.'0', $tableName, $value); |
|
269
|
269
|
} |
|
270
|
270
|
$statementParts['where'] = $values; |
|
271
|
271
|
|
|
@@ -304,25 +304,25 @@ discard block |
|
|
block discarded – undo |
|
304
|
304
|
if (!empty($statementParts['unions'])) { |
|
305
|
305
|
foreach ($statementParts['unions'] as $tableName => $unionPart) { |
|
306
|
306
|
if (!empty($statementParts['additionalWhereClause'][$tableName])) { |
|
307
|
|
- $statementParts['unions'][$tableName] .= ' AND ' . implode(' AND ', $statementParts['additionalWhereClause'][$tableName]); |
|
|
307
|
+ $statementParts['unions'][$tableName] .= ' AND '.implode(' AND ', $statementParts['additionalWhereClause'][$tableName]); |
|
308
|
308
|
} |
|
309
|
309
|
} |
|
310
|
310
|
} |
|
311
|
311
|
|
|
312
|
|
- $statement = 'SELECT ' . implode(' ', $statementParts['keywords']) . ' ' . implode(',', $statementParts['fields']) . ' FROM ' . implode(' ', $statementParts['tables']) . ' ' . implode(' ', $statementParts['unions']); |
|
|
312
|
+ $statement = 'SELECT '.implode(' ', $statementParts['keywords']).' '.implode(',', $statementParts['fields']).' FROM '.implode(' ', $statementParts['tables']).' '.implode(' ', $statementParts['unions']); |
|
313
|
313
|
if (!empty($statementParts['where'])) { |
|
314
|
|
- $statement .= ' WHERE ' . implode('', $statementParts['where']); |
|
|
314
|
+ $statement .= ' WHERE '.implode('', $statementParts['where']); |
|
315
|
315
|
if (!empty($statementParts['additionalWhereClause'][$this->query->getType()])) { |
|
316
|
|
- $statement .= ' AND ' . implode(' AND ', $statementParts['additionalWhereClause'][$this->query->getType()]); |
|
|
316
|
+ $statement .= ' AND '.implode(' AND ', $statementParts['additionalWhereClause'][$this->query->getType()]); |
|
317
|
317
|
} |
|
318
|
318
|
} elseif (!empty($statementParts['additionalWhereClause'])) { |
|
319
|
|
- $statement .= ' WHERE ' . implode(' AND ', $statementParts['additionalWhereClause'][$this->query->getType()]); |
|
|
319
|
+ $statement .= ' WHERE '.implode(' AND ', $statementParts['additionalWhereClause'][$this->query->getType()]); |
|
320
|
320
|
} |
|
321
|
321
|
if (!empty($statementParts['orderings'])) { |
|
322
|
|
- $statement .= ' ORDER BY ' . implode(', ', $statementParts['orderings']); |
|
|
322
|
+ $statement .= ' ORDER BY '.implode(', ', $statementParts['orderings']); |
|
323
|
323
|
} |
|
324
|
324
|
if (!empty($statementParts['limit'])) { |
|
325
|
|
- $statement .= ' LIMIT ' . $statementParts['limit']; |
|
|
325
|
+ $statement .= ' LIMIT '.$statementParts['limit']; |
|
326
|
326
|
} |
|
327
|
327
|
|
|
328
|
328
|
return $statement; |
|
@@ -339,10 +339,10 @@ discard block |
|
|
block discarded – undo |
|
339
|
339
|
{ |
|
340
|
340
|
if ($source instanceof SelectorInterface) { |
|
341
|
341
|
$tableName = $source->getNodeTypeName(); |
|
342
|
|
- $sql['fields'][$tableName] = $tableName . '.*'; |
|
|
342
|
+ $sql['fields'][$tableName] = $tableName.'.*'; |
|
343
|
343
|
$sql['tables'][$tableName] = $tableName; |
|
344
|
344
|
if ($this->query->getDistinct()) { |
|
345
|
|
- $sql['fields'][$tableName] = $tableName . '.' . $this->query->getDistinct(); |
|
|
345
|
+ $sql['fields'][$tableName] = $tableName.'.'.$this->query->getDistinct(); |
|
346
|
346
|
$sql['keywords']['distinct'] = 'DISTINCT'; |
|
347
|
347
|
} |
|
348
|
348
|
} elseif ($source instanceof JoinInterface) { |
|
@@ -367,15 +367,15 @@ discard block |
|
|
block discarded – undo |
|
367
|
367
|
$rightTableName = $rightSource->getLeft()->getSelectorName(); |
|
368
|
368
|
} else { |
|
369
|
369
|
$rightTableName = $rightSource->getSelectorName(); |
|
370
|
|
- $sql['fields'][$leftTableName] = $rightTableName . '.*'; |
|
|
370
|
+ $sql['fields'][$leftTableName] = $rightTableName.'.*'; |
|
371
|
371
|
} |
|
372
|
372
|
$sql['tables'][$leftTableName] = $leftTableName; |
|
373
|
|
- $sql['unions'][$rightTableName] = 'LEFT JOIN ' . $rightTableName; |
|
|
373
|
+ $sql['unions'][$rightTableName] = 'LEFT JOIN '.$rightTableName; |
|
374
|
374
|
$joinCondition = $join->getJoinCondition(); |
|
375
|
375
|
if ($joinCondition instanceof \TYPO3\CMS\Extbase\Persistence\Generic\Qom\EquiJoinCondition) { |
|
376
|
376
|
$column1Name = $joinCondition->getProperty1Name(); |
|
377
|
377
|
$column2Name = $joinCondition->getProperty2Name(); |
|
378
|
|
- $sql['unions'][$rightTableName] .= ' ON ' . $joinCondition->getSelector1Name() . '.' . $column1Name . ' = ' . $joinCondition->getSelector2Name() . '.' . $column2Name; |
|
|
378
|
+ $sql['unions'][$rightTableName] .= ' ON '.$joinCondition->getSelector1Name().'.'.$column1Name.' = '.$joinCondition->getSelector2Name().'.'.$column2Name; |
|
379
|
379
|
} |
|
380
|
380
|
if ($rightSource instanceof JoinInterface) { |
|
381
|
381
|
$this->parseJoin($rightSource, $sql); |
|
@@ -513,7 +513,7 @@ discard block |
|
|
block discarded – undo |
|
513
|
513
|
if ($realInput instanceof \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface) { |
|
514
|
514
|
return $realInput->getUid(); |
|
515
|
515
|
} else { |
|
516
|
|
- throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnexpectedTypeException('An object of class "' . get_class($realInput) . '" could not be converted to a plain value.', 1274799934); |
|
|
516
|
+ throw new \TYPO3\CMS\Extbase\Persistence\Generic\Exception\UnexpectedTypeException('An object of class "'.get_class($realInput).'" could not be converted to a plain value.', 1274799934); |
|
517
|
517
|
} |
|
518
|
518
|
} elseif (is_bool($input)) { |
|
519
|
519
|
return $input === true ? 1 : 0; |
|
@@ -558,9 +558,9 @@ discard block |
|
|
block discarded – undo |
|
558
|
558
|
$operator = $this->resolveOperator($operator); |
|
559
|
559
|
$constraintSQL = ''; |
|
560
|
560
|
if ($valueFunction === null) { |
|
561
|
|
- $constraintSQL .= (!empty($tableName) ? $tableName . '.' : '') . $columnName . ' ' . $operator . ' ?'; |
|
|
561
|
+ $constraintSQL .= (!empty($tableName) ? $tableName.'.' : '').$columnName.' '.$operator.' ?'; |
|
562
|
562
|
} else { |
|
563
|
|
- $constraintSQL .= $valueFunction . '(' . (!empty($tableName) ? $tableName . '.' : '') . $columnName . ') ' . $operator . ' ?'; |
|
|
563
|
+ $constraintSQL .= $valueFunction.'('.(!empty($tableName) ? $tableName.'.' : '').$columnName.') '.$operator.' ?'; |
|
564
|
564
|
} |
|
565
|
565
|
|
|
566
|
566
|
if (isset($tableName) && !empty($this->currentChildTableNameAlias)) { |
|
@@ -590,7 +590,7 @@ discard block |
|
|
block discarded – undo |
|
590
|
590
|
// to determine the relation type. Example for sys_category, property path will look like "items.sys_file" |
|
591
|
591
|
$parts = explode('.', $propertyPath, 3); |
|
592
|
592
|
if ($table->field($fieldName)->isGroup() && count($parts) > 2) { |
|
593
|
|
- $explodedPropertyPath[0] = $parts[0] . '.' . $parts[1]; |
|
|
593
|
+ $explodedPropertyPath[0] = $parts[0].'.'.$parts[1]; |
|
594
|
594
|
$explodedPropertyPath[1] = $parts[2]; |
|
595
|
595
|
$fieldName = $explodedPropertyPath[0]; |
|
596
|
596
|
} |
|
@@ -599,16 +599,16 @@ discard block |
|
|
block discarded – undo |
|
599
|
599
|
$childTableName = $table->field($fieldName)->getForeignTable(); |
|
600
|
600
|
|
|
601
|
601
|
if ($childTableName === null) { |
|
602
|
|
- throw new Exception\InvalidRelationConfigurationException('The relation information for property "' . $fieldName . '" of class "' . $tableName . '" is missing.', 1353170925); |
|
|
602
|
+ throw new Exception\InvalidRelationConfigurationException('The relation information for property "'.$fieldName.'" of class "'.$tableName.'" is missing.', 1353170925); |
|
603
|
603
|
} |
|
604
|
604
|
|
|
605
|
605
|
if ($table->field($fieldName)->hasOne()) { // includes relation "one-to-one" and "many-to-one" |
|
606
|
606
|
// sometimes the opposite relation is not defined. We don't want to force this config for backward compatibility reasons. |
|
607
|
607
|
// $parentKeyFieldName === null does the trick somehow. Before condition was if (isset($parentKeyFieldName)) |
|
608
|
608
|
if ($table->field($fieldName)->hasRelationManyToOne() || $parentKeyFieldName === null) { |
|
609
|
|
- $sql['unions'][$childTableName] = 'LEFT JOIN ' . $childTableName . ' ON ' . $tableName . '.' . $fieldName . '=' . $childTableName . '.uid'; |
|
|
609
|
+ $sql['unions'][$childTableName] = 'LEFT JOIN '.$childTableName.' ON '.$tableName.'.'.$fieldName.'='.$childTableName.'.uid'; |
|
610
|
610
|
} else { |
|
611
|
|
- $sql['unions'][$childTableName] = 'LEFT JOIN ' . $childTableName . ' ON ' . $tableName . '.uid=' . $childTableName . '.' . $parentKeyFieldName; |
|
|
611
|
+ $sql['unions'][$childTableName] = 'LEFT JOIN '.$childTableName.' ON '.$tableName.'.uid='.$childTableName.'.'.$parentKeyFieldName; |
|
612
|
612
|
} |
|
613
|
613
|
} elseif ($table->field($fieldName)->hasRelationManyToMany()) { |
|
614
|
614
|
$relationTableName = $table->field($fieldName)->getManyToManyTable(); |
|
@@ -773,11 +773,11 @@ discard block |
|
|
block discarded – undo |
|
773
|
773
|
foreach ($parameter as $item) { |
|
774
|
774
|
$items[] = $this->databaseHandle->fullQuoteStr($item, $tableName); |
|
775
|
775
|
} |
|
776
|
|
- $parameter = '(' . implode(',', $items) . ')'; |
|
|
776
|
+ $parameter = '('.implode(',', $items).')'; |
|
777
|
777
|
} else { |
|
778
|
778
|
$parameter = $this->databaseHandle->fullQuoteStr($parameter, $tableName); |
|
779
|
779
|
} |
|
780
|
|
- $sqlString = substr($sqlString, 0, $markPosition) . $parameter . substr($sqlString, ($markPosition + 1)); |
|
|
780
|
+ $sqlString = substr($sqlString, 0, $markPosition).$parameter.substr($sqlString, ($markPosition + 1)); |
|
781
|
781
|
} |
|
782
|
782
|
$offset = $markPosition + strlen($parameter); |
|
783
|
783
|
} |
|
@@ -878,18 +878,18 @@ discard block |
|
|
block discarded – undo |
|
878
|
878
|
// If the table is found to have "workspace" support, add the corresponding fields in the statement. |
|
879
|
879
|
if (Tca::table($tableName)->hasWorkspaceSupport()) { |
|
880
|
880
|
if ($this->getBackendUser()->workspace === 0) { |
|
881
|
|
- $statement .= ' AND ' . $tableName . '.t3ver_state<=' . new VersionState(VersionState::DEFAULT_STATE); |
|
|
881
|
+ $statement .= ' AND '.$tableName.'.t3ver_state<='.new VersionState(VersionState::DEFAULT_STATE); |
|
882
|
882
|
} else { |
|
883
|
883
|
// Show only records of live and of the current workspace |
|
884
|
884
|
// In case we are in a Versioning preview |
|
885
|
|
- $statement .= ' AND (' . |
|
886
|
|
- $tableName . '.t3ver_wsid=0 OR ' . |
|
887
|
|
- $tableName . '.t3ver_wsid=' . (int)$this->getBackendUser()->workspace . |
|
|
885
|
+ $statement .= ' AND ('. |
|
|
886
|
+ $tableName.'.t3ver_wsid=0 OR '. |
|
|
887
|
+ $tableName.'.t3ver_wsid='.(int)$this->getBackendUser()->workspace. |
|
888
|
888
|
')'; |
|
889
|
889
|
} |
|
890
|
890
|
|
|
891
|
891
|
// Check if this segment make sense here or whether it should be in the "if" part when we have workspace = 0 |
|
892
|
|
- $statement .= ' AND ' . $tableName . '.pid<>-1'; |
|
|
892
|
+ $statement .= ' AND '.$tableName.'.pid<>-1'; |
|
893
|
893
|
} |
|
894
|
894
|
|
|
895
|
895
|
if (!$includeDeleted) { |
|
@@ -915,25 +915,25 @@ discard block |
|
|
block discarded – undo |
|
915
|
915
|
if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) { |
|
916
|
916
|
if (!empty($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])) { |
|
917
|
917
|
// Select all entries for the current language |
|
918
|
|
- $additionalWhereClause = $tableNameOrAlias . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . ' IN (' . intval($querySettings->getLanguageUid()) . ',-1)'; |
|
|
918
|
+ $additionalWhereClause = $tableNameOrAlias.'.'.$GLOBALS['TCA'][$tableName]['ctrl']['languageField'].' IN ('.intval($querySettings->getLanguageUid()).',-1)'; |
|
919
|
919
|
// If any language is set -> get those entries which are not translated yet |
|
920
|
920
|
// They will be removed by t3lib_page::getRecordOverlay if not matching overlay mode |
|
921
|
921
|
if (isset($GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']) |
|
922
|
922
|
&& $querySettings->getLanguageUid() > 0 |
|
923
|
923
|
) { |
|
924
|
|
- $additionalWhereClause .= ' OR (' . $tableNameOrAlias . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0' . |
|
925
|
|
- ' AND ' . $tableNameOrAlias . '.uid NOT IN (SELECT ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'] . |
|
926
|
|
- ' FROM ' . $tableName . |
|
927
|
|
- ' WHERE ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'] . '>0' . |
|
928
|
|
- ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '>0'; |
|
|
924
|
+ $additionalWhereClause .= ' OR ('.$tableNameOrAlias.'.'.$GLOBALS['TCA'][$tableName]['ctrl']['languageField'].'=0'. |
|
|
925
|
+ ' AND '.$tableNameOrAlias.'.uid NOT IN (SELECT '.$tableName.'.'.$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']. |
|
|
926
|
+ ' FROM '.$tableName. |
|
|
927
|
+ ' WHERE '.$tableName.'.'.$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField'].'>0'. |
|
|
928
|
+ ' AND '.$tableName.'.'.$GLOBALS['TCA'][$tableName]['ctrl']['languageField'].'>0'; |
|
929
|
929
|
|
|
930
|
930
|
// Add delete clause to ensure all entries are loaded |
|
931
|
931
|
if (isset($GLOBALS['TCA'][$tableName]['ctrl']['delete'])) { |
|
932
|
|
- $additionalWhereClause .= ' AND ' . $tableNameOrAlias . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['delete'] . '=0'; |
|
|
932
|
+ $additionalWhereClause .= ' AND '.$tableNameOrAlias.'.'.$GLOBALS['TCA'][$tableName]['ctrl']['delete'].'=0'; |
|
933
|
933
|
} |
|
934
|
934
|
$additionalWhereClause .= '))'; |
|
935
|
935
|
} |
|
936
|
|
- $statementParts['additionalWhereClause'][$tableNameOrAlias][] = '(' . $additionalWhereClause . ')'; |
|
|
936
|
+ $statementParts['additionalWhereClause'][$tableNameOrAlias][] = '('.$additionalWhereClause.')'; |
|
937
|
937
|
} |
|
938
|
938
|
} |
|
939
|
939
|
} |
|
@@ -978,7 +978,7 @@ discard block |
|
|
block discarded – undo |
|
978
|
978
|
protected function parseLimitAndOffset($limit, $offset, array &$sql) |
|
979
|
979
|
{ |
|
980
|
980
|
if ($limit !== null && $offset !== null) { |
|
981
|
|
- $sql['limit'] = intval($offset) . ', ' . intval($limit); |
|
|
981
|
+ $sql['limit'] = intval($offset).', '.intval($limit); |
|
982
|
982
|
} elseif ($limit !== null) { |
|
983
|
983
|
$sql['limit'] = intval($limit); |
|
984
|
984
|
} |
|
@@ -1045,10 +1045,10 @@ discard block |
|
|
block discarded – undo |
|
1045
|
1045
|
&& $row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] > 0 |
|
1046
|
1046
|
) { |
|
1047
|
1047
|
$row = $this->databaseHandle->exec_SELECTgetSingleRow( |
|
1048
|
|
- $tableName . '.*', |
|
|
1048
|
+ $tableName.'.*', |
|
1049
|
1049
|
$tableName, |
|
1050
|
|
- $tableName . '.uid=' . (int)$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']] . |
|
1051
|
|
- ' AND ' . $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0' |
|
|
1050
|
+ $tableName.'.uid='.(int)$row[$GLOBALS['TCA'][$tableName]['ctrl']['transOrigPointerField']]. |
|
|
1051
|
+ ' AND '.$tableName.'.'.$GLOBALS['TCA'][$tableName]['ctrl']['languageField'].'=0' |
|
1052
|
1052
|
); |
|
1053
|
1053
|
} |
|
1054
|
1054
|
} |
|
@@ -1107,7 +1107,7 @@ discard block |
|
|
block discarded – undo |
|
1107
|
1107
|
} |
|
1108
|
1108
|
|
|
1109
|
1109
|
$numberOfAliases = $this->tableNameAliases['aliasIncrement'][$tableName]; |
|
1110
|
|
- $tableNameAlias = $tableName . $numberOfAliases; |
|
|
1110
|
+ $tableNameAlias = $tableName.$numberOfAliases; |
|
1111
|
1111
|
|
|
1112
|
1112
|
$this->tableNameAliases['aliasIncrement'][$tableName]++; |
|
1113
|
1113
|
$this->tableNameAliases['aliases'][$tableNameAlias] = $tableName; |
|
@@ -1186,7 +1186,7 @@ discard block |
|
|
block discarded – undo |
|
1186
|
1186
|
{ |
|
1187
|
1187
|
$error = $this->databaseHandle->sql_error(); |
|
1188
|
1188
|
if ($error !== '') { |
|
1189
|
|
- $error .= $sql ? ': ' . $sql : ''; |
|
|
1189
|
+ $error .= $sql ? ': '.$sql : ''; |
|
1190
|
1190
|
throw new \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Exception\SqlErrorException($error, 1247602160); |
|
1191
|
1191
|
} |
|
1192
|
1192
|
} |