Commit 335389a6 authored by Christian Kuhn's avatar Christian Kuhn Committed by Benni Mack
Browse files

[BUGFIX] SQL error in some MM workspaces discard scenarios

Depending on SQL structure of an MM table, the recent fix for
issue #93064 can lead to query errors: It works with core
category relations but fails for instance with ext:news
'related news' relations. This is due to an assumption
about existence of field 'tablenames', which is bogus.
If needed, the according where restriction comes from TCA
MM_match_fields already, which is sufficient.

Resolves: #93109
Related: #93064
Releases: master, 10.4
Change-Id: Ifcc15989f87119cfb10c2da47c22b42a0dd4558a

Tested-by: default avatarTYPO3com <>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <>
Tested-by: default avatarSebastian Michaelsen <>
Tested-by: Benni Mack's avatarBenni Mack <>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <>
Reviewed-by: default avatarSebastian Michaelsen <>
Reviewed-by: Benni Mack's avatarBenni Mack <>
parent 793fc121
......@@ -5359,14 +5359,6 @@ class DataHandler implements LoggerAwareInterface
// uid_local = given uid OR uid_foreign = given uid
$queryBuilder->expr()->eq($relationUidFieldName, $queryBuilder->createNamedParameter($recordUid, \PDO::PARAM_INT))
if ($relationUidFieldName === 'uid_foreign') {
// When discarding a local-side record - eg. sys_category - it does not matter who points to it,
// all relations can be dropped. If on foreign side - eg. tt_content to sys_category - "tablenames"
// field has to be taken into account to not delete rows with same uid from other tables.
$queryBuilder->expr()->eq('tablenames', $queryBuilder->createNamedParameter($table, \PDO::PARAM_STR))
if (!empty($fieldConfig['MM_table_where']) && is_string($fieldConfig['MM_table_where'])) {
QueryHelper::stripLogicalOperatorPrefix(str_replace('###THIS_UID###', (string)$recordUid, $fieldConfig['MM_table_where']))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment