简体   繁体   中英

TYPO3 extbase - query with multiple languages - how to define language for subtables / persistance\ObjectStorage

I have a table with multiple 1:n subtables that have translations.

Now the client wants to list all records on all language versions of the website. The problem is that Extbase caches the values of the different ObjectStorages and does not differentiate between the languages. Now if I have two records with the same record the first one will fetch the title and this one is then being used for all records. So I have a crazy language mis-match.

I would like to define the language overlay of the subtables fixed for sys_language_uid and don't know how. This code: https://gist.github.com/hhoechtl/a374f7526440ba987c19 does work perfectly for a single-select but it does not work for my listview..

Is there any way I could force the language of the subqueries?

As an example. This is an italian record (sys_l = 1) and it gets shown on the german detailview with german subinfo: ( https://jobfinder.look4u.it/de/job?tx_jobfinder_stellenanzeigen%5Baction%5D=show&tx_jobfinder_stellenanzeigen%5Bcontroller%5D=Stellenanzeigen&tx_jobfinder_stellenanzeigen%5Bstellenausschreibung%5D=149&cHash=6da4a876cac6125e3b0f5b0924f35463 )

When you open it on the italian page ( https://jobfinder.look4u.it/it/job?tx_jobfinder_stellenanzeigen%5Baction%5D=show&tx_jobfinder_stellenanzeigen%5Bcontroller%5D=Stellenanzeigen&tx_jobfinder_stellenanzeigen%5Bstellenausschreibung%5D=149&cHash=6da4a876cac6125e3b0f5b0924f35463 ) the additional info is nicely in italian thanks to the code from hhoechtl above.

But the problem is in the listview where german (0) and italian gets mixed: https://jobfinder.look4u.it/de/anzeigen-arbeitgeber/agenturen

Extbase takes the values of 2 properties from the first record (sales controller) in italian and then keeps that lookup for all folowing records. And I'm not able to change the lookup here in the listview. The code from hhoechtl somehow doesnt work in this query.

I have found a solution. The patch released in July 2022 actually solves exactly this problem!

https://review.typo3.org/c/Packages/TYPO3.CMS/+/75099/2

Since I'm running v10 on this site I have manually implemented the patch on my T3 version and now Extbase is behaving as it should.

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