[TYPO3-mvc] Respect storage page ignored on object properties

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Mon May 31 15:33:27 CEST 2010


Am 31.05.2010 15:06, schrieb Jochen Rau:
> Ok, but how to solve your problem? IMO you should alter your domain
> model from
>
> class Category {
>      var $products
> }
>
> to
>
> class Product {
>      var $categories
> }
>
> as a Category is more of a ValueObject that an Entity. The next step
> depends upon the quantity of products you have to manage. I always try
> to put the logic to fetch the necessary subset of products in the
> controller using a find*() method of the appropriate Repository.
> For your case a $query->intersect('categories' $categories) would be
> handy but it should also work by concatenating
> $query->contains('categories', $category) with $query->logicalOr().

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.

Thanks a lot,
Thomas


More information about the TYPO3-project-typo3v4mvc mailing list