[TYPO3-ttnews] tx_news: Language fallback of category names in Backend/Frontend does not work
Frank Gerards
frank.gerards at gmx.de
Tue Sep 24 14:57:55 CEST 2013
Ok,
I found some "buggy" or "unstable" behavior in the findDemanded Method inside the NewsRepository, which is triggered from the listAction in the newsController.
In essence: The find and constraint builder methods in the tx_news Extension mix up a language-sensitive base query with a constraint that is NOT language sensitive. Given a OR category constraint configured in the backend, a query like this is passed to the database:
'SELECT tx_news_domain_model_news.* FROM tx_news_domain_model_news WHERE (tx_news_domain_model_news.uid IN (SELECT uid_local FROM tx_news_domain_model_ news_category_mm WHERE uid_foreign='9') AND tx_news_domain_model_news.pid IN ('91')) AND (tx_news_domain_model_news.type='0' OR tx_news_domain_model_news.type='1' OR tx_news_domain_model_news.type='2') AND tx_news_domain_model_news.deleted=0 AND tx_news_domain_model_news.t3ver_state<=0 AND tx_news_domain_model_news.pid<>-1 AND tx_news_domain_model_news.hidden=0 AND tx_news_domain_model_news.starttime<=1380027120 AND (tx_news_domain_model_news.endtime=0 OR tx_news_domain_model_news.endtime>1380027120) AND (tx_new
s_domain_model_news.fe_group='' OR tx_news_domain_model_news.fe_group IS NULL OR tx_news_domain_model_news.fe_group='0' OR FIND_IN_SET('0',tx_news_domain_model_news.fe_group) OR FIND_IN_SET('-1',tx_news_domain_model_news.fe_group)) ORDER BY tx_news_domain_model_news.datetime DESC
uid_foreign = 9 points to the uid of the Category in the DEFAULT LANGUAGE (it is NOT translated yet),
but the query has a sys_language_uid IN (-1,1) constraint (respectSysLanguage = true).
So the conclusion its trying to fetch a sys-language=1 news record while constraining it with a news-category uid in sys_language_uid=0.
My quick solution was:
$query->getQuerySettings()->setRespectSysLanguage(false);
in the findDemanded() method in the AbstractNewsRepository.
Maybe Georg knows better how to set up a correct fall-back-secure querying in its extension, would be nice !
More information about the TYPO3-project-tt-news
mailing list