[TYPO3-dev] Extbase and group by
Klaas Johan Kooistra
k.j.kooistra at youwe.nl
Tue Jul 22 15:58:16 CEST 2014
Hi,
I need a group by query in Extbase and from what I've found so far this
is impossible with the default Extbase functionality. What do I need it
for? Consider the following models:
- Product: May exist in multiple Folders but is unique to each Folder
- FolderItem: Contains 1 Product
- Folder: May contain multiple FolderItems and is linked to a user
Now I need a listing of all FolderItems of a user. However, this will
cause the same Product to be displayed multiple times if it exists in
multiple Folders. The logical solution: Group by Product uid.
So I tried manipulating the query object, "manually" parsing the query
in a custom extended TYPO3DbBackend method, adding a group by and then
setting the query statement. This actually works for retrieving the data
and you recieve a query result, which you can use for instance with the
paginate view helper.
But then I added a count, which I need to display the number of items.
And the number is wrong, because the count obviously does nothing with
the modified statement. Unfortunately I can't figure out yet how to
proceed from here and I'm hoping someone here may know a good solution.
Thanks in advance for any thoughts
More information about the TYPO3-dev
mailing list