[TYPO3-mvc] Using mm-table for sorting in query

Michael Knoll mimi at kaktusteam.de
Sun Feb 27 02:31:47 CET 2011


Hi there,

I have kind of problem with sortings. My table structure looks like this:

gallery <-- gallery_album_mm --> album

Inside the gallery_album_mm table, I have a field 'sorting' that is used 
for sorting albums in a gallery.

Now I want to create a query that allows me to get the albums in the 
right sorting for a gallery WITHOUT USING THE GALLERY object like 
$gallery->getAlbums(). For the reasons see below.

Does anybody have an idea how I can do that. Normally I would use kind 
of a JOIN statement and order the albums due to the joined field 'sorting':

SELECT * FROM album
JOIN gallery_album_mm mm ON mm.foreign_uid = album.uid
ORDER BY mm.foreign_sorting

But there is no join in repository queries... so what can I do?

Any help would be highly appreciated!


Greetings

Mimi


Reasons for not using gallery->getAlbums(): We are using a generic 
extension building lists from extbase queries. In the mechanism of 
creating these lists, we create an extbase query by translating a 
generic query object to an extbase query object. Whatever result we get 
from this query has to be mapped on a domain model. All this stuff works 
pretty well, as long as we do not have to use the sorting described 
above. So any hints on how this problem could be solved would make our 
extension a little more generic... :-)


More information about the TYPO3-project-typo3v4mvc mailing list