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

Jochen Rau jochen.rau at typoplanet.de
Wed Dec 23 00:16:58 CET 2009


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


-- 
Every nit picked is a bug fixed



More information about the TYPO3-project-typo3v4mvc mailing list