Skip to content

Instantly share code, notes, and snippets.

@dmitryd
Last active September 7, 2017 07:35
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmitryd/8579c0ef6bbebfefe79d to your computer and use it in GitHub Desktop.
Save dmitryd/8579c0ef6bbebfefe79d to your computer and use it in GitHub Desktop.
Fix issue with incorrect localization handling in Extbase (missing support for l10n_mode=exclude, which makes some relations missing). See http://bit.ly/1Djw1CV
<?php
namespace DmitryDulepov\Sample\Xclass;
class Typo3DbQueryParser extends \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser {
/**
* Fixes incorrect localisation handling in Extbase.
*
* @param string $tableName
* @param array $sql
* @param \TYPO3\CMS\Extbase\Persistence\Generic\QuerySettingsInterface $querySettings
*/
protected function addSysLanguageStatement($tableName, array &$sql, $querySettings) {
if (is_array($GLOBALS['TCA'][$tableName]['ctrl'])) {
if (!empty($GLOBALS['TCA'][$tableName]['ctrl']['languageField'])) {
$sql['additionalWhereClause'][] = $tableName . '.' . $GLOBALS['TCA'][$tableName]['ctrl']['languageField'] . '=0';
}
}
}
}
/*
Do not forget to register Xclass like:
$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Storage\\Typo3DbQueryParser'] = array(
'className' => 'DmitryDulepov\\Sample\\Xclass\\Typo3DbQueryParser',
);
*/
@fnagel
Copy link

fnagel commented Sep 7, 2017

Link above is dead, here is the archive record: https://web.archive.org/web/20150502175529/http://www.dmitry-dulepov.com:80/2015/01/strange-code-in-extbase-persistance.html

Afaik this patch is not suitable for TYPO3 7.6 or 8.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment