FLOW3 rocks. However, the current documentation is… well… a bit short 🙂 The quickstart guide and the blog example show you the basics of working with FLOW3 and Fluid, its templating engine. But for explanations or examples of even the slightest more complex functionality you have to search the web for quite some time (or at least I had to ;-)).
Like today: I wanted to map an object of type Invoice to an object of type Client in a Fluid view. How do you do that, so that FLOW3 instantiates a real Client object and hands it over to the Invoice object upon its instantiation? It turns out, all you have to provide the framework to magically do that, is something like a select tag with the Client objects’ GUIDs like this:
<select name="client">
<option value="80f870ee-931c-4706-8716-fb3e52bbe450">Client 1</option>
<option value="fb2cd21e-64e8-439b-bff2-be51948b8ff5">Client 2</option>
</select>
But how do you do that using Fluid? I found the solution (mainly by chance) here: FLOW3 – your first relation between to models.
<f:form.select property="client" name="client" options="{clients}" optionLabelField="name" />
If you omit the attribute optionValueField on the view helper f:form (see Fluid ViewHelper Reference), the objects’ GUIDs are magically used for the values of the options in the HTML form and FLOW3 figures out that it has to instantiate Client objects.
Pingback:Dj Turntable Packages | Record Players for Sale Here
Pingback:Beating Problems to succeed in Your current Target | Amazon Lose Weight