Skip to content

Commit

Permalink
[BUGFIX] Fetch correct uid for ###REC_FIELD and group fields
Browse files Browse the repository at this point in the history
If a field is used in `foreign_table_where` configuration which
points to a field using `group` as type, the uid needs to be fetched
differently from the processed row.

Resolves: #17073
Releases: master, 9.5
Change-Id: I8ec9c7cd0dd166a0c4e87a61adb2f87b7c1c8cf5
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63775
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
georgringer authored and bmack committed Mar 19, 2020
1 parent 4700766 commit 10e64f2
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -1081,8 +1081,10 @@ protected function processForeignTableClause(array $result, $foreignTableName, $
$rowFieldValue = $result[$databaseRowKey][$whereClauseSubParts[0]] ?? '';
if (is_array($rowFieldValue)) {
// If a select or group field is used here, it may have been processed already and
// is now an array. Use first selected value in this case.
$rowFieldValue = $rowFieldValue[0];
// is now an array containing uid + table + title + row.
// See TcaGroup data provider for details.
// Pick the first one (always on 0), and use uid only.
$rowFieldValue = $rowFieldValue[0]['uid'] ?? $rowFieldValue[0];
}
if (substr($whereClauseParts[0], -1) === '\'' && $whereClauseSubParts[1][0] === '\'') {
$whereClauseParts[0] = substr($whereClauseParts[0], 0, -1);
Expand Down

0 comments on commit 10e64f2

Please sign in to comment.