Skip to content

Commit

Permalink
[BUGFIX] Make QueryGenerator handle multiple label_alt columns
Browse files Browse the repository at this point in the history
The label_alt field in TCA is a comma separated list of database
columns, so it needs to be exploded before being passed into a
database query.

Resolves: #83268
Releases: master, 10.4
Change-Id: I5daf07acd3ee2d409d970ac896408bec2e0abe33
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70057
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
  • Loading branch information
LiquidPL authored and tmotyl committed Aug 16, 2021
1 parent 9108f31 commit ab1d989
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Database/QueryGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ public function makeOptionList($fieldName, $conf, $table)
}
$selectFields = ['uid', $labelField];
if ($altLabelField) {
$selectFields[] = $altLabelField;
$selectFields = array_merge($selectFields, GeneralUtility::trimExplode(',', $altLabelField, true));
}
$queryBuilder->select(...$selectFields)
->from($from_table)
Expand Down
4 changes: 2 additions & 2 deletions typo3/sysext/lowlevel/Classes/Database/QueryGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ protected function makeValueList($fieldName, $fieldValue, $conf, $table, $splitS
$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
$selectFields = ['uid', $labelField];
if ($altLabelField) {
$selectFields[] = $altLabelField;
$selectFields = array_merge($selectFields, GeneralUtility::trimExplode(',', $altLabelField, true));
}
$queryBuilder->select(...$selectFields)
->from($from_table)
Expand Down Expand Up @@ -2048,7 +2048,7 @@ protected function makeOptionList($fieldName, $conf, $table)
}
$selectFields = ['uid', $labelField];
if ($altLabelField) {
$selectFields[] = $altLabelField;
$selectFields = array_merge($selectFields, GeneralUtility::trimExplode(',', $altLabelField, true));
}
$queryBuilder->select(...$selectFields)
->from($from_table)
Expand Down

0 comments on commit ab1d989

Please sign in to comment.