[TYPO3-mvc] Using mm-table for sorting in query
Franz Koch
typo3.RemoveForMessage at elements-net.de
Mon Feb 28 13:37:02 CET 2011
Hey,
>>> 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?
>>
>> I fear your albums need a backreference to the gallery. After having
>> that it shouldn't be a big deal. Is it possible for you to add
>> backreferences to the albums?
>
> With the query above and by using an backrefence you will get the
> sorting of galleries for albums (foreign_sorting) and not the sorting
> albums for galleries (sorting).
yah right. And after thinking about it again the backreference doesn't
help here either - you would need a intermediate object instead of the
mm-table in order to address it easily via the QOM.
So you probably have to create that statement by hand then:
$query = $this->createQuery();
return $query->statement('SELECT * FROM ... JOIN ... ORDER
BY...')->execute();
Or digg into the QOM and build it with low level QOM commands ($query is
just a wrapper - so probably check out what the queryObject does
internally to get started with the QOM).
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list