[TYPO3-mvc] How to return a filtered subset of child objects?

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Sat Feb 13 12:26:47 CET 2010


That maybe would be the best solution, but what would be
the correct way of using the find method inside the view?

The problem ist, that I assign the category directly, and
fluid will just call getProducts based on the markup:

<f:for each="{category.products}" as="product"/>

Or do you recommend to assign the products seperately, like:

$this->view->assign('desiredProducts', 
$this->productRepository->findByCriteria($category, $filters));

This way I could only assign filtered products by the controller,
while the category model will always return all assigned products.

Thanks,
Thomas

Am 13.02.2010 09:29, schrieb Sebastian Kurfürst:
> Hi Thomas,
>
> As I understood it right now, you get a filter, and you want to restrict
> the products which are shown based on this filter.
>
> So, why not write a "find"-method inside the repository which will get
> the Filter as an argument, and then build the whole object tree of
> categories and products to conform to the selected filter?
>
> I feel this would be more in line with MVC, as it is the job of the
> controller to give the data to be rendered to the view.
>
> Greets,
> Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list