Project

General

Profile

Actions

Bug #86405

open

querySetting setRespectSysLanguage (wrong implementation of "strict"-mode)

Added by Rainer Roskothen over 5 years ago. Updated about 4 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase + l10n
Target version:
-
Start date:
2018-09-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hello,

in TYPO3 9.4 the use of "setRespectSysLanguage" returns no translated records in "strict"-mode. I'm developing an extension to search a list of media. Each medium has an english record and a translated german record in a table media, so for example

(English)
uid: 11
sys_language_uid: 0
l10n_parent: 0
medium: water

(German)
uid: 12
sys_language_uid: 1
l10n_parent: 11
medium: Wasser

In the media repository I set up a query like

$query = $this->createQuery();
$query->getQuerySettings()->setRespectSysLanguage(true);
$constraint = $query->like('medium', '%' . $medium . '%');
$query->matching($constraint);
return $query->execute();

The expected result is: record 11 on the english page and record 12 on the german page. Currently I get the follwing result: record 11 on the english page, no record on the german page.

Prompting the underlying SQL query (english, short version) looks like:

SELECT * FROM media media
WHERE (medium LIKE '%water%') AND (sys_language_uid IN (0, -1))
AND (pid = 278) AND ((deleted = 0) AND (t3ver_state <= 0) AND (pid <> -1)
AND (hidden = 0) AND (starttime <= 1538051940) AND ((endtime = 0) OR (endtime > 1538051940)))

and (german, short version)

SELECT * FROM media media
WHERE (medium LIKE '%wasser%')
AND ((sys_language_uid = -1) OR ((sys_language_uid = 1) AND (l10n_parent = 0))
OR ((sys_language_uid = 0) AND (uid IN (SELECT l10n_parent FROM media WHERE (l10n_parent > 0) AND (sys_language_uid = 1) AND (deleted = 0)))))
AND (pid = 278) AND ((deleted = 0) AND (t3ver_state <= 0) AND (pid <> -1)
AND (hidden = 0) AND (starttime <= 1538051940) AND ((endtime = 0) OR (endtime > 1538051940)))

And now my questions:
1. Why is the table media nested two times in the query "FROM media media" ?
2a. The term "OR ((sys_language_uid = 1) AND (l10n_parent = 0))" cause the empty result by excluding all records with sys_language_uid=1 and l10n_parent pointing to an uid of the english record. Why?
or
2b. The term "OR ((sys_language_uid = 0) AND (uid IN (SELECT l10n_parent FROM media WHERE (l10n_parent > 0) AND (sys_language_uid = 1) AND (deleted = 0))))" cause the empty result by excluding all records with l10n_parent>0 and usually sys_language_uid=1 (and not 0). Why?

Eventually this issue is related to Bug #45873 which started in 2013 for TYPO3 6.0 and isn't solved yet.

Thanks for your attention and help
Rainer


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Bug #59992: Persistence session doesn't take overlays into accountClosed2014-06-30

Actions
Related to TYPO3 Core - Bug #45873: querySettings setRespectSysLanguage or setSysLanguageUid does not workNeeds Feedback2013-02-27

Actions
Actions

Also available in: Atom PDF