Project

General

Profile

Actions

Bug #75810

closed

Extbase fails to properly matching a value against a non-translated property

Added by Nicola Heisch about 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase + l10n
Start date:
2016-04-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
extbase localization
Complexity:
Is Regression:
No
Sprint Focus:

Description

Description

If you create an Extbase query (\TYPO3\CMS\Extbase\Persistence\Generic\Query) and filter by a property which has "l10n_mode" => exclude it will still try to match the property to the translated records instead of the parents.

Extbase should filter out records with a language parent at this stage of the query, since it does the record overlay afterwards in any case.

Steps to reproduce

(I've attached an extension which demonstrates the issue)

  • Have a TYPO3 installation with at least 2 languages
  • Install the provided extension (attached to the ticket)
  • Create a record with the value "test" in the field "Nontranslatedproperty"
  • Translate that record
  • Add the plugin on any page
  • Run the plugin on any sys_language other than default

Expected result

Example 1:


        $query = $this->testMasterRepository->createQuery();
        $query->matching(
            $query->equals('nontranslatedproperty', 'test')
        );
        $test = $query->execute();

Should return the record with "nontranslatedproperty" => "test"

Actual result

Doesn't return the expected record in any sys_language other than 0/-1

Example which returns the expected result

        $query = $this->testMasterRepository->createQuery();
        $querySettings = $query->getQuerySettings();
        $querySettings->setRespectSysLanguage(false);
        $query->setQuerySettings($querySettings);

        $query->matching(
            $query->logicalAnd(
                $query->logicalOr(
                    $query->in('sys_language_uid', [0, -1]),
                    $query->logicalAnd(
                        $query->equals('sys_language_uid', $querySettings->getLanguageUid()),
                        $query->equals('l10n_parent', 0)
                    )
                ),
                $query->equals('nontranslatedproperty', 'test')
            )
        );

        $test = $query->execute();

Files

test_0.0.0_201604201200.zip (510 KB) test_0.0.0_201604201200.zip Extension which demonstrates the issue Nicola Heisch, 2016-04-20 12:19
Actions

Also available in: Atom PDF