[TYPO3-mvc] Respect storage page ignored on object properties
Franz Koch
typo3.RemoveForMessage at elements-net.de
Tue Jun 1 00:49:21 CEST 2010
Hi,
> Okay, that's fine, I have relations in both directions already defined,
> so that's not the problem, but I want to use the template like this:
>
> <f:for each="{categories}" as="category">
>
> <h1>{category.title}</h1>
>
> <f:for each="{category.products}" as="product">
>
> <h2>{product.title}</h2>
>
> </f:for>
> </f:for>
>
> And I'm not sure how to handle it with using a product repository then.
as I already wrote - add a new getter to your category model (like
"getAvailableProducts" and call a service inside it that's only
returning the filtered products e.g. via a call to
$this->productRepository->findByCategoryInBranch($category,$branch)).
That's how I'd do (and have done) it. But don't forget to cache the
result set of the service somehow so that not every
{category.availableProducts} is triggering a DB query.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list