简体   繁体   中英

Typo3 7.6 extbase repository matching only affect non-localized records

I want to create an own extbase extension for TYPO3 CMS 7.6. The extension has to run in different languages. I figured out, that the repository matching does only work for me with non-localized records.

My repository function looks like that:

public function findNew() {
  $query = $this->createQuery();
  $query->getQuerySettings()->setRespectSysLanguage(true);
  $query->matching($query->equals('new', 1));
  return $query->execute();
}

This function says: Show all records with new = 1

Example: I have a default record that has the checkbox "New" NOT activated. Now I create a localized version of this record and set the "New" checkbox to activated.

If I execute the function findNew() in the default language, the record will not show up. If I execute the function in another language, the record will also not show up although the "New"-flag is set!

In other words: The matching does only affect the default/parent record.

I'm using the following config-settings:

config {
  sys_language_mode = strict
  sys_language_overlay = hideNonTranslated
}

[Edit:] Here's the complete generated SQL query:

SELECT tx_extension_domain_model_table.*
FROM
tx_extension_domain_model_table
WHERE
  tx_extension_domain_model_table.new = '1'
  AND (
    tx_extension_domain_model_table.sys_language_uid = -1
    OR (
      tx_extension_domain_model_table.sys_language_uid = 1
      AND tx_extension_domain_model_table.l10n_parent = 0
    )
    OR (
      tx_extension_domain_model_table.sys_language_uid = 0
      AND tx_extension_domain_model_table.uid IN (
        SELECT tx_extension_domain_model_table.l10n_parent
        FROM tx_extension_domain_model_table
        WHERE tx_extension_domain_model_table.l10n_parent > 0
          AND tx_extension_domain_model_table.sys_language_uid = 1
          AND tx_extension_domain_model_table.deleted = 0
      )
    )
  )
  AND tx_extension_domain_model_table.deleted = 0
  AND tx_extension_domain_model_table.t3ver_state <= 0
  AND tx_extension_domain_model_table.pid <> -1
  AND tx_extension_domain_model_table.hidden = 0
  AND tx_extension_domain_model_table.starttime <= 1459780380
  AND (tx_extension_domain_model_table.endtime = 0 OR     tx_extension_domain_model_table.endtime > 1459780380)
ORDER BY tx_extension_domain_model_table.sorting ASC

...and the important part:

    AND (
        tx_extension_domain_model_table.sys_language_uid = -1
    OR (
      tx_extension_domain_model_table.sys_language_uid = 1
      AND tx_extension_domain_model_table.l10n_parent = 0
    )
    OR (
      tx_extension_domain_model_table.sys_language_uid = 0
      AND tx_extension_domain_model_table.uid IN (
        SELECT tx_extension_domain_model_table.l10n_parent
        FROM tx_extension_domain_model_table
        WHERE tx_extension_domain_model_table.l10n_parent > 0
          AND tx_extension_domain_model_table.sys_language_uid = 1
          AND tx_extension_domain_model_table.deleted = 0
      )
    )
  )

That explains my problem. TYPO3 is not looking for new = 1 in sys_language_uid = 1 when it's localized... but why?

Question: Is this a bug or a feature?

这是extbase中的一个错误,请点击此处获取更多信息: https ://forge.typo3.org/issues/57272

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM