Moin Moin,
schreibe gerade an meiner ersten mehrsprachigen Extbase-Extension. Hat auch soweit alles super geklappt und Extbase nimmt einem echt viel Arbeit in Sachen Mehrsprachigkeit ab.
Jetzt bin ich aber auf ein Problem gestoßen.
Ich habe in meiner Extension "Satellitenbild"-Datensätze, denen 0-mehrere Kontinente zugeordnet sind.
Bei der Englischen Übersetzung habe ich die Felder für die Kontinent-Zuordnung mit der Zeile
$TCA['tx_wpsatellite_domain_model_image']['columns']['continent']["l10n_mode"] = 'exclude';
ausgeblendet. Das Bild gehört ja zu keinem anderen Kontinent, nur weil ich es übersetzt habe. Daher lasse ich das Feld gleich weg, damit es der Backenduser nicht jedesmal übersetzen muss.
So weit so gut.
Wenn ich nun mein Query zusammenbaue und den Constraint
$query->equals('continent.uid', $params["continent"]);
definiere, und nach einem Satellitenbild in Europa suche (Habe eine HTML-Suchmaske mit Selectbox), dann findet er es nicht.
Also habe ich mir das Statement angesehen, das von Extbase generiert wird:
SELECT COUNT(DISTINCT tx_wpsatellite_domain_model_image.uid) FROM tx_wpsatellite_domain_model_image LEFT JOIN tx_wpsatellite_image_continent_mm ON tx_wpsatellite_domain_model_image.uid = tx_wpsatellite_image_continent_mm.uid_local LEFT JOIN tx_wpsatellite_domain_model_continent ON tx_wpsatellite_image_continent_mm.uid_foreign = tx_wpsatellite_domain_model_continent.uid WHERE tx_wpsatellite_domain_model_continent.uid = 2 AND tx_wpsatellite_domain_model_image.deleted = 0 AND tx_wpsatellite_domain_model_image.t3ver_state <= 0 AND tx_wpsatellite_domain_model_image.pid <>- 1 AND tx_wpsatellite_domain_model_image.hidden = 0 AND tx_wpsatellite_domain_model_image.starttime <= 1372061460 AND ( tx_wpsatellite_domain_model_image.endtime = 0 OR tx_wpsatellite_domain_model_image.endtime > 1372061460 ) AND ( tx_wpsatellite_domain_model_image.sys_language_uid IN ( 1, -1 ) OR ( tx_wpsatellite_domain_model_image.sys_language_uid = 0 AND tx_wpsatellite_domain_model_image.uid NOT IN (SELECT tx_wpsatellite_domain_model_image.l10n_parent FROM tx_wpsatellite_domain_model_image WHERE tx_wpsatellite_domain_model_image.l10n_parent > 0 AND tx_wpsatellite_domain_model_image.sys_language_uid > 0 AND tx_wpsatellite_domain_model_image.deleted = 0) ) ) AND tx_wpsatellite_domain_model_image.pid IN ( 30 ) AND tx_wpsatellite_domain_model_continent.deleted = 0 AND tx_wpsatellite_domain_model_continent.t3ver_state <= 0 AND tx_wpsatellite_domain_model_continent.pid <>- 1 AND tx_wpsatellite_domain_model_continent.hidden = 0 AND tx_wpsatellite_domain_model_continent.starttime <= 1372061460 AND ( tx_wpsatellite_domain_model_continent.endtime = 0 OR tx_wpsatellite_domain_model_continent.endtime > 1372061460 ) AND ( tx_wpsatellite_domain_model_continent.sys_language_uid IN ( 1, -1 ) OR ( tx_wpsatellite_domain_model_continent.sys_language_uid = 0 AND tx_wpsatellite_domain_model_continent.uid NOT IN (SELECT tx_wpsatellite_domain_model_continent.l10n_parent FROM tx_wpsatellite_domain_model_continent WHERE tx_wpsatellite_domain_model_continent.l10n_parent > 0 AND tx_wpsatellite_domain_model_continent.sys_language_uid > 0 AND tx_wpsatellite_domain_model_continent.deleted = 0) ) ) AND tx_wpsatellite_domain_model_continent.pid IN ( 30 )
Das Problem ist die Zeile "AND ( tx_wpsatellite_domain_model_continent.sys_language_uid IN ( 1, -1 ) " in der WHERE-Clause.
Er lest damit nur Kontinente mit der Language-Uid 1 aus, also Englische. Allerdings sind meine zugewiesenen Kontinente ja nur in der Standardsprache zugewiesen.
Ändere ich die Zeile auf "AND ( tx_wpsatellite_domain_model_continent.sys_language_uid IN ( 0, -1 )" dann klappt es.
Ich müsste daher die Mehrsprachigkeit im JOIN mit dem Kontinent ausschalten. Oder hat jemand eine andere Idee wie man dieses Problem lösen könnte?
Habe mich schon durch etliche Google-Einträge und Bücher gekämpft aber keine Antwort gefunden.
Bin für alle Vorschläge offen
Liebe Grüße und Danke!

