[TYPO3-mvc] Using repository inside an entity

Henrik Møller Rasmussen info at hmrdesign.dk
Sat May 1 12:51:44 CEST 2010


On 26/04/10 11.09, Martin Kutschker wrote:
> Jochen Rau schrieb:
>>
>> Maybe the Tx_Fluid_ViewHelpers_GroupedForViewHelper is your friend here.
>> Just fetch all your items and group them in the template.
>
> Possible caveat: you can group by properties that are scalars, not by objects.
>
> Masi

Hello all,

Thanks for your answers, and sorry for my late reply.

The problem is that a category has multiple products, where a product 
can the be marked as either for sale or as a request. That means, that 
the category.products contain products of both types. This has the 
problem that when querying the count in fluid, or using the grouped for, 
it is not possible to count the items (because they need to be of the 
right type). Therefore I created a method on a category called 
getItemsForSale() and getItemsForRequest(), which used the repository to 
fetch only the items belonging to the specific category with the correct 
type.

It works for now, but I would probably create it a little different next 
time :-)

- Henrik




More information about the TYPO3-project-typo3v4mvc mailing list