Last active
September 7, 2017 07:35
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', | |
); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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