[TYPO3-mvc] Selecting records which have MM relations to another table

Jochen Rau jochen.rau at typoplanet.de
Fri Dec 18 19:54:33 CET 2009


Hi.

schrieb Sebastian Kurfürst:
>> Now I need to make an action on my Documentcontroller that lists all
>> Documents in a given category (or several categories actually). How do I do
>> this? Using
>>
>> $this->documentRepository =
>> t3lib_div::makeInstance('Tx_applusDocument_Domain_Repository_DocumentReposit
>> ory');
>
>> $Query = $this->documentRepository->createQuery();
> Does this work? I thought createQuery() was protected, and not public.
> Definitely it should be protected.

IMHO it's not a bug. It's a feature to be able to create a query 
wherever you have a Repository at hand. That's also in sync with FLOW3.

> Currently you create the query inside your controller, but you should
> rather create a custom method inside your repository, where you build
> the query, and execute it.

Yes, it's the recommended way to implement a findWhatever() method 
inside a Repository doing all the query related stuff.

Regards
Jochen

-- 
Every nit picked is a bug fixed



More information about the TYPO3-project-typo3v4mvc mailing list