Typo3 Extbase Repository->findAll() returns empty

2020-04-08 13:55发布

I just can't findAll() make return anything even though I am able to access a specific record by findByUid().

I have taken note (and tried to workaround / set up) of the typoscript solution and the record storage page bug without any success.

I am using a dummy extension code made by the extension builder in TYPO3 (current version) for your convenience. I have tested with data manually added through the TYPO3 config ui.

Any help would be much appreciated.

All the best and thanks in advance

Mario

1条回答
老娘就宠你
2楼-- · 2020-04-08 14:46

For 99.9 % you didn't set your storagePid properly, it has to be the PID of the page where your records are stored. Effect: findAll() uses this PID to filter the records, while findByUid(uid) ignores PID (it searches by UID wherever record is stored.

Go to the main page > Templates and make sure that you included TypoScript from your new ext, then go to constant editor and set proper PID of page with your records. Clear whole cache at the end!

Also you can debug your SQL statement like in this answer, most probably at the end of statement you'll see something like AND your_table_name.pid IN (0) which definitely means that you didn't set storagePid or you didn't clear the cache.

查看更多
登录 后发表回答