Object iteration in a FLUID template


I just want to output all properties of an object (historyEntry) in a for loop like this:

<f:for each="{historyEntry}" as="historyProperty" key="label">

The for viewhelper only accepts arrays. There is no f:format.array viewhelper (to convert the object).
Is there a simple solution to do the iteration?


The ForViewHelper accepts arrays and objects implementing the \Traversable interface.
So you could either turn your object into an Iterator, add a getter that returns an array or create a custom ViewHelper for your use case

Hi Bastian!

That’s great news. It will save me a lot of monkey business:
Many of our domain models have history objects, to keep in track who has changed what and when.
So, most of the properties have to be copied to a history object on update().
I will play around a bit, to see what fits best.

Thanks (for the other posting too)