[TYPO3-mvc] Passing filters by array or custom object? Which is the better approach?

Jochen Rau jochen.rau at typoplanet.de
Tue Jan 19 17:29:53 CET 2010


Hi David.

On 11.01.10 14:43, David Schreiber wrote:
> 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?

I have recently committed a bunch of changes to trunk (r1789). Here is 
an excerpt of the commit message:

Transient objects (uid === NULL) are now recursively converted into an 
array of properties if they are passed as GET/POST arguments (redirect).

Restricted conversion of DomainObjects into an array of properties if 
they are passed as GET/POST arguments (redirect) to ValueObjects. If the 
conversion fails, an Tx_Extbase_MVC_Exception_InvalidArgumentValue is 
thrown.

Maybe that fits your needs.

Jochen


More information about the TYPO3-project-typo3v4mvc mailing list