[TYPO3-mvc] QAW: Simple question!? Filter List with localization...

Markus Klein klein.t3 at mfc-linz.at
Mon Jan 20 13:31:00 CET 2014


Hi Stephan,

very nice summary.
It shows the complexity of the involved methods.
One way to solve the overlay stuff could be to do it in stored procedures on the DB. Hence you can apply filtering etc on the result of the procedure.

One thing I'd like to add: We do not always do overlaying in language processing, it strongly depends on the TS settings. So never assume the user of an extension actually does use overlaying. ;-)

Kind regards
Markus

------------------------------------------------------------
Markus Klein
TYPO3 CMS Active Contributors Team Member

> -----Original Message-----
> From: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-
> project-typo3v4mvc-bounces at lists.typo3.org] On Behalf Of Stephan Schuler
> Sent: Monday, January 20, 2014 11:40 AM
> To: 'Alex Kellner'; 'TYPO3 v4 MVC project'
> Subject: [TYPO3-mvc] QAW: Simple question!? Filter List with localization...
> 
> Hey there.
> 
> 
> I faced a problem which might be related to this. Form a very superficial
> perspective it this could be the case for what you experience.
> 
> The thing is: The Typo3DbBackend limits queries to "sys_language_uid IN (0, -
> 1)", which is "default language and 'all'", but no translation value and no
> "language record which isn't a translation".
> 
> I do have a change for this, but since it's a very central behavior of the
> current Extbase and changing it would be very very breaking, I think we
> cannot call it a bug even if it might be one.
> 
> My solution for now goes by "xclass" the Typo3DbBackend. Xclassing stuff
> always is pretty ugly, but I didn't find a better solution until now.
> 
> That's the TypoScript:
> >
> config.tx_extbase.objects.Tx_Extbase_Persistence_Storage_BackendInterf
> > ace.className =
> Tx_Yourextension_Persistence_Storage_Typo3DbBackend
> 
> And here's the PHP stuff:
> > http://pastebin.com/GiXscvx0
> 
> 
> This doesn't really *solve* your problem because you have a translation
> (sys_language_uid=1, l10n_parent=0) instead of a "not-translated foreign
> language record" (sys_language_uid=1, l10n_parent=$parentRecord).
> But maybe you find a solution based on my explanation.
> 
> 
> Think about this situation:
> 
> Record 1: uid=100, sys_language_uid=0, l10n_parent=0, title="a" - default
> language, so no translation.
> Record 2: uid=101, sys_language_uid=1, l10n_parent=100, title="a" -
> translation of the first record Record 3: uid=102, sys_language_uid=1,
> l10n_parent=0, title="a" - not a translation, but originally created as foreign-
> language record
> 
> Search for "a" in sys_language_uid=1.
> 
> The default behavior of would resoult only uid=100 because it matches, and
> do the language overlay to uid=101 after that.
> My change directly finds uid=100 and uid=102. The uid=100 will be overlayed
> by uid=101 just like normal.
> 
> From this example you can see: Both "SELECT" statements do not directly
> search the uid=101-Record. The 101 is only returned as an overlay of 100, but
> not covered by the raw SQL.
> If you extend the "addSysLanguageStatement" to cover the uid=101-record
> as well, you will find all three records -- which is plain wrong, too.
> 
> So a generic solution isn't that simple.
> 
> The main problem (imho) is, that there is partial overlay caused by TCA
> (fallback fields). This always requires PHP side post processing. If your SELECT
> stuff (no matter if it is high level like QOM) targets values that are only
> calculated (fallback fields that are taken from sys_language_uid=0 because
> they are either not translated at all or "mergeIfNotBlank") and hence this
> requires PHP processing, that thingy completely destroys lazy Query
> execution and query processing which is a central feature of e.g. pagination.
> I really hope I could explain the problem properly. It's a very annoying show
> stopper because this means calculating SELECT properly and performance
> boosts like pagination will never occur at the same time :(.
> 
> A really generic solution would create TCA based view on the database and
> throw a SELECT statement. But I doubt anybody will transform TCA to SQL
> just to make SELECT against it. There are ~6500 lines of code in the TCEmain /
> DataHandler, and I guess ~2000 of them would be required to be migrated to
> a huge "TcaSqlFactory". That's way out of scope, imho. This doesn't stop with
> language. If you have versioning/workspaces, there's another layer of
> complexity which goes by the very same principles  -- overlaying that needs
> to be done in the database to have generically processed scope to apply
> filters to.
> 
> 
> Regards,
> 
> 
> 
> Stephan Schuler
> Web-Entwickler
> 
> Telefon: +49 (911) 539909 - 0
> E-Mail: Stephan.Schuler at netlogix.de
> Website: media.netlogix.de
> 
> 
> 
> --
> netlogix GmbH & Co. KG
> IT-Services | IT-Training | Media
> Neuwieder Straße 10 | 90411 Nürnberg
> Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
> E-Mail: info at netlogix.de | Internet: http://www.netlogix.de
> 
> netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA
> 13338) Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH
> (HRB 20634)
> Umsatzsteuer-Identifikationsnummer: DE 233472254
> Geschäftsführer: Stefan Buchta, Matthias Schmidt
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-
> project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von Alex Kellner
> Gesendet: Montag, 20. Januar 2014 10:59
> An: typo3-project-typo3v4mvc at lists.typo3.org
> Betreff: [TYPO3-mvc] Simple question!? Filter List with localization...
> 
> I ran into a strange problem with extbase and maybe someone knows the
> answer.
> 
> *Configuration:*
> * Let's create a simple Object with just one property (e.g. title)
> * Configure TYPO3 with &L=0 for german and &L=1 for english
> * In addition add one record in the backend list view and localize it (see
> attached image) - I wrote "deutsch" and "english" in both titles.
> 
> *Extension:*
> 1) Add a FE Plugin with a controller and make a findAll() in the controller. You
> will see the germany record in L=0 and the english record in L=1 - so far so
> good
> 2) Now we want to add a filter field over the list. Let's create an own
> repository method:
> <pre>
>         public function findByTitleTest() {
>                 $query = $this->createQuery();
> 
>                 $query->matching(
>                         $query->like('title', 'eng%')
>                 );
> 
>                 return $query->execute();
>         }
> </pre>
> You will not find a record with "eng%" in &L=1 but you will find a record with
> "deu%".
> 
> Tested in TYPO3 4.5 and 4.7
> 
> Is this a bug or do we need to do the localization by our own with
> setRespectSysLanguage(FALSE);?
> 
> My Test extension as t3x file for download:
> www [dot] in2code [dot] de/fileadmin/user_upload/T3X_tt_news-3_4_0-z-
> 201401201049.t3x
> begin 644 loc.png
> MB5!.1PT*&@H````-24A$4@```DD```!W"`8````7;]3``````7-21T(`KLX<
> MZ0````1G04U!``"QCPO\804````)<$A9<P``#L,```[#`<=OJ&0``!%+241!
> M5'A>[9V+;U37G<?G3TD(HA6*5(0L^@@1*ZJL4Q6"*:$@P&`Z3LHBW`!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
> ,!8W
> M#A$1'R3?GS%#+A\\*/_WQAOR\:Z=\O&.'?*_-35R\;77I.>QQ^3TM&GRCY__
> M7`8M/[#"5/]/?RKG5J^6P5_^4OXK+"2YZXS_AL*R9^M4UIP1."8A:?6)J%1T
> MELG*]J6RXMABO[ZLY6E9V#Q;2MXIEB?WS?#K4[8_*I,KOR:3MCPBDUZ9X->S
> M9X8/4O"56,*KN,3CV+R.ZMSY[A$/+")B(7KY\F7Y\LLO[=]>TW^#[?:U:W9`
> M.C5EBMS\]%.Y>?.FW+AQ0ZY?OVZKCD^=.F6<T]=_>^%I6J.4K#DFQR0DK>I8
> M)LT#C=+4?U"BK0O\^H)W9\D;?ZN5ZK]LD1E[ON77)_]JDBQJFB<+#\V5B9L>
> M]NM9-<,'284<?XQ53Q62$JXS=:OT)/17\L`B(A:"ERY=LD.2"D?ZK_A_9H4D
> M%9"Z)T^6ZU8?+R!Y?TM)'9\\>=(X)V;',0E)*XXMD4/G&J2Q[X"]>^35GVIX
> M0BK?VR2_Z%HKTW9-\>N3-D^0!;\OD?F-<^21#0_Y];Q3O7[S0P\B(F)JU1^)
> MU'>0_%_UMX)0[ZQ9TE-
> <+#<N7]9VDF*[282D^^N8A*3RUH6R_.A\67IDGBP^
> M7.+7G]C[N#R^>YI,VSE%OE$]V:^KW:.)&Q^R`U)^A22UVZ/M"L7M!"$B(J;6
> M]%>TU1^)[+,"T&^LM>77EJ<[.^7TZ=/VZ[53W=UV./(TS8G9D2]N(R(B(AHD
> M)"$B(B(:)"0A(B(B&B0D(2(B(AHD)"$B(B(:)"0A(B(B&B0D(2(B(AH,#4F(
> MB(B(A6K2D(2(B(A8R!*2$!$1$0T2DA`1$1$-$I(0$1$1#1*2$!$1$0T2DA`1
> B$1$-$I(0$1$1$[PC_P*;]=],ZY8-_0````!)14Y$KD)@@@``
> `
> end
> 
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list