Project

General

Profile

Actions

Bug #47192

closed

setRespectSysLanguage(FALSE) doesn't prevent language overlay when fetching localized objects

Added by Rony Khoury about 11 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Could have
Assignee:
-
Category:
Extbase + l10n
Target version:
-
Start date:
2013-04-13
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

My understanding of $query->setRespectSysLanguage(FALSE); is the following: when this flag is set, the repository should ignore any language settings and just return the plain data behind a given UID.

While trying to recreate the behavior mentioned in Bug #26852, I found that setting $query->setRespectSysLanguage(FALSE); does not prevent the returned data from being localized.

Example Repository method:

/**
 * get raw data
 *
 * @param integer $uid The identifier of the object to find
 * @return array he matching object if found, otherwise NULL
 */
public function findRawByUid($uid)
{
    $query = $this->createQuery();
    $query->getQuerySettings()->setRespectSysLanguage(FALSE);
    $query->getQuerySettings()->setRespectStoragePage(FALSE);
    $query->getQuerySettings()->setReturnRawQueryResult(TRUE);

    $object = $query->matching(
        $query->equals('uid', $uid)
    );

    $object = $query->execute();

    return $object;
}

Let's say we have two database entries with UID 1 as the original (english) entry and one with UID 3 as the localized version of the same entry (danish).

Calling $this->testItemRepository->findRawByUid(1); in the FE with URL Parameter &L=1 (page translated to danish) it returns the following array:

array(1 item)
   0 => array(25 items)
      uid => '1' (1 chars)
      pid => '73' (2 chars)
      tstamp => '1364428533' (10 chars)
      crdate => '1364425144' (10 chars)
      cruser_id => '1' (1 chars)
      deleted => '0' (1 chars)
      hidden => '0' (1 chars)
      starttime => '0' (1 chars)
      endtime => '0' (1 chars)
      lastname => 'Mustermann Dansk' (16 chars)
      t3ver_oid => '0' (1 chars)
      t3ver_id => '0' (1 chars)
      t3ver_wsid => '0' (1 chars)
      t3ver_label => '' (0 chars)
      t3ver_state => '0' (1 chars)
      t3ver_stage => '0' (1 chars)
      t3ver_count => '0' (1 chars)
      t3ver_tstamp => '0' (1 chars)
      t3ver_move_id => '0' (1 chars)
      t3_origuid => '1' (1 chars)
      sys_language_uid => '1' (1 chars)
      l10n_parent => '1' (1 chars)
      l10n_diffsource => 'a:7:{s:16:"sys_language_uid";s:1:"0";s:11:"l10n_par
         ent";s:1:"0";s:9:"firstname";s:11:"Max English
         ";s:8:"lastname";s:18:"Mustermann English";s:6:&quo
         t;hidden";s:1:"0";s:9:"starttime";s:1:"0" 
         ;s:7:"endtime";s:1:"0";}' (208 chars)
      firstname => 'Max Dansk' (9 chars)
      _LOCALIZED_UID => '3' (1 chars)

Instead of getting the english version I get the translated one.

Calling the same page in the default language (&L=0) it returns the correct raw data:

array(1 item)
   0 => array(24 items)
      uid => '1' (1 chars)
      pid => '73' (2 chars)
      tstamp => '1364427396' (10 chars)
      crdate => '1364413354' (10 chars)
      cruser_id => '1' (1 chars)
      deleted => '0' (1 chars)
      hidden => '0' (1 chars)
      starttime => '0' (1 chars)
      endtime => '0' (1 chars)
      lastname => 'Mustermann English' (18 chars)
      t3ver_oid => '0' (1 chars)
      t3ver_id => '0' (1 chars)
      t3ver_wsid => '0' (1 chars)
      t3ver_label => '' (0 chars)
      t3ver_state => '0' (1 chars)
      t3ver_stage => '0' (1 chars)
      t3ver_count => '0' (1 chars)
      t3ver_tstamp => '0' (1 chars)
      t3ver_move_id => '0' (1 chars)
      t3_origuid => '0' (1 chars)
      sys_language_uid => '0' (1 chars)
      l10n_parent => '0' (1 chars)
      l10n_diffsource => 'a:1:{s:6:"hidden";N;}' (21 chars)
      firstname => 'Max English' (11 chars)

To cut a long story short, $query->setRespectSysLanguage(FALSE); doesn't seem to work.


Related issues 2 (1 open1 closed)

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

Actions
Related to TYPO3 Core - Bug #82363: Make Extbase translation handling consistent with typoscriptClosedTymoteusz Motylewski2017-09-07

Actions
Actions

Also available in: Atom PDF