[TYPO3-dev] Extbase: ignore sys_language_uid (=list all db-table entries)

Stefan Franke stefan.franke at gmx.co.uk
Wed Nov 27 11:29:06 CET 2013


Hello,
I am developing a backend module with Extbase in a multilingual TYPO3-environment (TYPO3 6.1.6). The task, I want to achieve, is quite simple: the backend module should list model-entries no matter what their sys_language_uid is. My database entries e.g. look like this:

uid | title   | sys_language_uid
----+---------+-----------------
  1 | deutsch |                0
----+---------+-----------------
  2 | english |                1
----+---------+-----------------

So in my repository the code for building the query looks as follows:

$query = $this->createQuery();
$query->getQuerySettings()->setRespectSysLanguage(0);
$aRow = $query->execute()->toArray();

I am doing some SQL-debugging with the following code in the buildQuery-function (right before the return):

if (in_array("tx_blah_domain_model_mymodel", $sql['tables'])) {
   print_r($statement);
}

The puzzling phenomenon (at least for myself) is this: when I put the SQL-statement from the debug-output into phpMyAdmin, all works fine. I receive all the entries in the database table, no matter if it is the original or the translated entry.

When I debug (= print_r) the array that my repository returns, I do in fact get two entries, but it's not the original and the translated one - it's twice the original one. So I'm getting something like this:

[0] => VENDOR\CellentGallery\Domain\Model\MyModel Object
        (
            [title:protected] => deutsch
            [uid:protected] => 1
            [_localizedUid:protected] => 1
            [_languageUid:protected] => 0
        )

    [1] => VENDOR\CellentGallery\Domain\Model\MyModel Object
        (
            [title:protected] => deutsch
            [uid:protected] => 1
            [_localizedUid:protected] => 1
            [_languageUid:protected] => 0
        )

Any ideas as to how I can achieve my goal or where I've got an error in reasoning?
		
Thanks for your help!

Kind regards,
Stefan
-- 
Diese E-Mail wurde aus dem Sicherheitsverbund E-Mail made in
Germany versendet: http://www.gmx.net/e-mail-made-in-germany



More information about the TYPO3-dev mailing list