[TYPO3-mvc] How to make a join inside a Query object

Michael Knoll mimi at kaktusteam.de
Wed Dec 23 02:56:37 CET 2009


Hi Jochen,

thanks for your answer... will have a look at it tomorrow and go to 
sleep now!

Greetings

Michael



Jochen Rau schrieb:
> Hi Michael.
> 
> schrieb Michael Knoll:
>> can anybody give me a hint on how I can realize a join inside a Query
>> object? What I have is the following:
>>
>> Table1: Image
>> Table1: Album
>> MM-Table: Image-Album-MM
>>
>> Now I would like to limit the number of images per Album-page
>>
>> So I wrote a query like that:
>>
>> $query = $this->imageRepository->createQuery();
>> $query->setLimit($this->itemsPerPage);
>> $query->setOffset(($this->currentPageNumber - 1) * $this->itemsPerPage);
>>
>> What I need is something like
>>
>> SELECT * FROM image
>> JOIN image_album_mm ON image.uid = image_album_mm.image_uid
>> WHERE image_album_mm.album_uid = $albumUid
>> LIMIT $offset:$limit
>>
>> Can anybody give me a hint how I can achieve that using the Extbase
>> Query object?
> 
> Left Joins are implemented but the handling is a little bit 
> uncomfortable, yet. See 
> Tx_Extbase_Persistence_DataMapper->getPreparedQuery() for a working 
> example.
> 
> Regards
> Jochen
> 
> 


More information about the TYPO3-project-typo3v4mvc mailing list