[TYPO3-mvc] Viewhelper giving back objects

Henjo Hoeksma me at henjohoeksma.nl
Fri Nov 19 23:35:59 CET 2010


Hi list,

I am trying to make a selection of objects using a viewhelper. I do 
this to get the right objects displayed based on some getVars.

What is the way to have a viewhelper return the objects?

Right now I have an array returned - which if I debug - produces an 
array with the object.
If I use the output in a for condition in fluid though, I keep getting 
the exception:

The argument "each" was registered with type "array", but is of type 
"string" in view helper "Tx_Fluid_ViewHelpers_ForViewHelper"

I annotated the render function in my VH to give it back as an array.

What is the way to accomplish this?
I know how to write a custom query in the repository, but I would like 
to use as less custom queries as possible and like to see if I can 
achieve this with the help of ViewHelpers.

A related question: what would the impact on performance be if I do it 
this way?

Thanks in advance for your thoughts.

Henjo



More information about the TYPO3-project-typo3v4mvc mailing list