[TYPO3-mvc] Passing filters by array or custom object? Which is the better approach?
David Schreiber
flashmasterdash at gmail.com
Mon Jan 11 14:43:47 CET 2010
Hello Everybody!
I'm trying to realize a listing view of products.
I made a small list.html template and an apropriate action inside my
Product Controller.
The list action looks like this:
/**
* list action
* @param $filter array|mixed The filters passed to the list
* @param $sortBy string The sort criteria
* @param $count int The Number of commodities to display at one page
* @param $page int The page to display
* @return string The rendered list action
*/
public function listAction( $filter=NULL, $sortBy='title', $count=10,
$page=1 ) {
...
...
}
I want the list action to take all the products out of the repository
which match the passed filter criteria (given with $filter).
Now I'm not sure about how to build up my filters the best way.
First I thought about passing them as a hash-array - but I don't know
how to create arrays inside a fluid template. Is this possible?
Second try would be to create a special class for the Filters, which
stores all filter options, and pass them as an object - would this be
a better solution, or does this create a too big overhead?
How would you realize that?
Thank you,
David Schreiber
More information about the TYPO3-project-typo3v4mvc
mailing list