[TYPO3-mvc] extbase: database query with mm relation

Firmenkonto pgeldmacher at best-mediaforge.com
Mon Jan 18 13:09:26 CET 2010


Hey,

I've one problem with the database layer in extbase. So, i've a blog 
with posts and in these posts are categories. One post has many 
categories and one category has many posts.

In my database table, i've a colmun named  "categories". All categories 
to a post are counted there.

I've done this in my post repository:
$query->matching($query->equals('categories', $object->getUid()));
$object is the category object.

The problem is that the query doesn't distinguish that it must select 
over the mm relation to the category table.

I need a statement like this:
SELECT * FROM post WHERE Uid IN( SELECT uid_local FROM post_category_mm 
WHERE uid_foreign = (SELECT Uid FROM category WHERE Uid = ?));

Do i have to write my own statement to implement this or can i use an 
other method from the Query class ?

Thanks a lot,

Pascal


More information about the TYPO3-project-typo3v4mvc mailing list